Freemarker - access value at a particular key in map

淺唱寂寞╮ 提交于 2019-12-01 17:29:08

问题


I have Map variable in my Freemarker template. How can I fetch a value at a particular key in the map, as we do in Java (map.get(<key>)).

I know how to iterate through keys and values of a map in a FTL. But I want a solution without iteration, on the lines of Java get() method of Map interface.


回答1:


map[dynamicKey] or map.staticKey if the key is a string. Due to historical limitations, if the key isn't a string, map?api.get(nonStringKey).



来源:https://stackoverflow.com/questions/39248560/freemarker-access-value-at-a-particular-key-in-map

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!