in velocity can you iterate through a java hashmap's entry set()?

前端 未结 4 1062
傲寒
傲寒 2021-02-01 12:52

Can you do something like this in a velocity template?

#set ($map = $myobject.getMap() )
#foreach ($mapEntry in $map.entrySet())
    $mapEntry.key()&         


        
4条回答
  •  执笔经年
    2021-02-01 13:31

    I'm looking for a way to loop through a HashMap in velocity, and this will work too.

    #set ($map = $myobject.getMap())
    #foreach( $key in $map.keySet())
          $key
          $resume.get($key)
    #end
    

    Just like the way you would loop through a HashMap in java.

提交回复
热议问题