我在FreeMarker模板.process上有一个空错误,但地图被评估了



我有一个带有freeMarker template.process(tempName, Map<String,> valueMap(的oribkem

freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> entity  [in template "myTemplate.html.ftl" at line 128, column 56]
FTL stack trace ("~" means nesting-related):
- Failed at: #if entity.has("firstValue")  [in template "myTemplate.html.ftl" at line 128, column 51]

在调试时,我的地图被评估,但对于解析器,显示为空值。

我使用 FreeMarker 2.3.30

谢谢姚

问题出在entity.has("firstValue"):这不是正确的自由标记语法。

要访问内置?而不是.,Freemarker也没有内置的哈希has。 参考: https://freemarker.apache.org/docs/ref_builtins_hash.html

最新更新