开发者

How to add values to dynamic(?) map in velocity?

开发者 https://www.devze.com 2023-03-01 17:18 出处:网络
I have the following velocity code. #foreach($content in $list) #set($map = {$content.categoryName:[]})

I have the following velocity code.

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

   #foreach($child in $children)
      // I want to add values to $map.$content.categoryName
   #end
#end

I would like to add values to $map.$content.categoryName. I tried

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

but it didn't work. I al开发者_StackOverflowso tried

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

But it still didn't work. Could someone please help me with this problem.


It's java, not javascript:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消