Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Velocity 如何在速度中为动态(?)贴图添加值?_Velocity - Fatal编程技术网

Velocity 如何在速度中为动态(?)贴图添加值?

Velocity 如何在速度中为动态(?)贴图添加值?,velocity,Velocity,我有下面的速度代码 #foreach($content in $list) #set($map = {$content.categoryName:[]}) #foreach($child in $children) // I want to add values to $map.$content.categoryName #end #end 我想向$map.$content.categoryName添加值。我试过了 $map.$content.categoryN

我有下面的速度代码

#foreach($content in $list)
   #set($map = {$content.categoryName:[]})

   #foreach($child in $children)
      // I want to add values to $map.$content.categoryName
   #end
#end
我想向
$map.$content.categoryName
添加值。我试过了

$map.$content.categoryName.add(values here) 
但它不起作用。我也试过了

$map[$content.categoryName].add(values here)

但它仍然不起作用。有人能帮我解决这个问题吗。

这是java,不是javascript:


$map.get($content.categoryName).add($child.value)

No:)但我非常习惯于人们在语法和服务器端渲染时间与客户端渲染时间上混淆这两者。所以我有时会做出完全不必要的假设。我的道歉不,不需要道歉。我只是查了一下我的问题,然后我想。。“哦……我发错问题了吗?”实际上,你是在列表中添加值,而不是在地图中添加值。地图正好在地图上。