首页 > 其他 > 详细

freemarker应用中遇到的错误

时间:2017-01-03 08:40:06      阅读:390      评论:0      收藏:0      [点我收藏+]

严重: Servlet.service() for servlet [default] in context with path [/whiteStruts2] threw exception

java.lang.IllegalStateException: Cannot call sendError() after the response has been committed

at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:462)

at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:770)

at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:505)

at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

......等以下我就不复制粘贴了


网页有如下异常:FreeMarker template error!

Expression title is undefined on line 4, column 18 in test.ftl.
The problematic instruction:
----------
==> ${title} [on line 4, column 16 in test.ftl]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression title is undefined on line 4, column 18 in test.ftl.
	at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
	at freemarker.core.Expression.getStringValue(Expression.java:118)
	at freemarker.core.Expression.getStringValue(Expression.java:93)
	at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
	at freemarker.core.Environment.visit(Environment.java:208)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:208)
	at freemarker.core.Environment.process(Environment.java:188)
	at freemarker.template.Template.process(Template.java:237)
	at org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:187)
	at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
	at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

解决方法:在freemarker的应用中,出现如上错误是因为,你的ftl模板中的某一个(比如:${name}),其中name并没有放入Map中或者不存在这样的key.

本文出自 “10963493” 博客,转载请与作者联系!

freemarker应用中遇到的错误

原文:http://10973493.blog.51cto.com/10963493/1888267

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!