开发者

how to set a map value in velocity

开发者 https://www.devze.com 2023-02-22 22:46 出处:网络
I tried to define a map in velocity template using the following s开发者_如何学编程yntax. It did not work, does anyone know how to declare a map of constant values in velocity?

I tried to define a map in velocity template using the following s开发者_如何学编程yntax. It did not work, does anyone know how to declare a map of constant values in velocity?

#set ($mymap = {"key" : "value" , "key2" : "value"})

EDIT: I am using 1.6.3 version of velocity


It worked for me. Maybe you have very old version of Velocity?

#set ($mymap = {"key" : "value" , "key2" : "value2"})

get: ${mymap.key} 
or:  ${mymap.get("key")}
0

精彩评论

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