![](/img/trans.png)
[英]how to get specific key value from a hashmap using freemarker template
[英]Freemarker + Java - How to “lookup” a value using key
在Java中,要使用键查找值,我会使用.get
方法:
String value = hashmap.get(key);
在Freemarker中,显然.get
已被弃用或其他东西,因为当我尝试使用它时:
<#list hash?keys as key>
<p>${hash.get(key)}</p>
</#list>
它返回一个null异常:
freemarker.core.InvalidReferenceException: The following has evaluated to null or missing
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${hash.get(key)} [in template "___.ftl" at line ___, column ___]
----
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.