![](/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.