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)??

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)??

-----------------

提示:如果没有表达是合法的空/失踪,或者指定一个默认值myoptionalvar!mydefault,或使用< #如果myoptionalvar??>在< #别的>当失踪/ # <<如果>>。(这些仅覆盖的表达;最后一步覆盖整个表达式,使用parenthessis:(myoptionvar。Foo)!mydefault,(myoptionvar。Foo)??

大概意思是应该进行判断,对象是否为空

一般出现这种异常的原因为:如果对象为空,则freemarker就会抛出这个异常。

其实解决很简单,在用对象之前先判空,不空在进行属性的获取操作即可

原文地址

时间: 2024-08-06 15:58:59

freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]的相关文章

freemarker.core.InvalidReferenceException: Expression stackObject.value.get(propertyName).toString() is undefined

很奇怪的报错, 在实体中添加 toString方法后, 想在前台列表中使用 <s:debug标签调试, 发现报错如下: freemarker.core.InvalidReferenceException: Expression stackObject.value.get(propertyName).toString() is undefined on line 58, column 122 in template/simple/debug.ftl.    at freemarker.core.T

解决 HTTP Status 500 - Unable to show problem report: freemarker.core.InvalidReferenceException:

HTTP Status 500 - Unable to show problem report: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> msg [in template "org/apache/struts2/dispatcher/error.ftl" at line 68, column 31] Tip: If the fail

freemarker.core.InvalidReferenceException

1.错误描述 freemarker.core.InvalidReferenceException:on line 68,column 18 in ftl/inc/incPro.ftl p.mainSelect not found 2.错误原因 由于宏定义的组件已经删除,但是在页面中还是运用了该组件 3.解决办法 删除已经没有定义宏的组件,防止页面报错

Better exception message for missing @RequestBody method parameter

https://jira.spring.io/browse/SPR-12888 Description When I use @RequestBody on one of my controllers for a required parameter, I need some useful way of saying which parameter was missing if it's not there. The exception message I see currently looks

记一次Jenkins 打包异常 ERROR: Exception when publishing, exception message [Failure]

今天早上打包一直都没有问题,突然有一次打包突然出现异常现象,如下: ERROR: Exception when publishing, exception message [Failure] Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE 我很好奇,服务器启动日志没有报错,Jenkins上的配置信息也没有去动它,为什么会出现这种异常呢,于是,我看了下那台机器上的磁盘存储情况

Elasticsearch Exception:Message not fully read (response) for requestId

本地使用Netty+Elasticsearch测试表单请求查询数据,无异常.将工程打包上传至服务器运行,页面请求后发生异常,连接关闭. 事件:前台通过Netty请求资源,Netty后台通过前台请求的JSON向ES查询数据,发生异常. 异常状况: 21:39:46,019  WARN org.elasticsearch.transport.netty:752 - [Jeanne-Marie Beaubier] exception caught on transport layer [[id: 0x

freemarker.core.ParseException:Unexpected end of file reached

1.错误原因 2.错误原因 由于在宏定义中,运用组件时没有关闭标签,导致出错 3.解决办法 添加关闭标签,或者给/>

Spring mvc 中使用ftl引用共通文件出错 FreeMarker template error: Error reading included file &quot;/WEB-INF/ftl/common/errormessage.ftl&quot;

初次接触spring mvc,想做一个小的练习项目,结果在ftl文件中引用其它的共通ftl文件时出错. 目录结构如图所示,想在login.ftl中引用common下的errormessage.ftl <#include '/WEB-INF/ftl/common/errormessage.ftl' /> 结果画面报错: FreeMarker template error: Error reading included file "/WEB-INF/ftl/common/errormes

Freemarker中日期时间格式出错

今天遇到一个奇怪的问题.同事访问我电脑发布的程序页面,freemarker日期格式报错.而其他电脑访问则没有问题. 先贴出错误信息. FreeMarker template error The string doesn't match the expected date/time/date-time format. The string to parse was: "2015-08-27 11:50:35.013". The expected format was: "MMM