freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above
Posted 壹品轩
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above 相关的知识,希望对你有一定的参考价值。
FreeMarker template error:
The following has evaluated to null or missing:
==> product [in template "product.html" at line 751, column 43]
FreeMarker模板误差:
以下已评估为null或丢失:
=产品“模板”产品HTML“在第751行,第43栏]
----------------------------
意思是有个值为null,就是不存在,
Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??
一般出现这种异常的原因为:如果对象为空,则freemarker就会抛出这个异常。
其实解决很简单,在用对象之前先判空,不空在进行属性的获取操作即可
以上是关于freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above 的主要内容,如果未能解决你的问题,请参考以下文章