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

前端 未结 4 1150
傲寒
傲寒 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:37

    To clarify (I cannot comment), in general you can use either the Java get methods, or replace them by the corresponding name without with a small letter and without ().

    So $mapEntry.getKey() or map.key.

提交回复
热议问题