无线&移动互联网技术研发

换位思考·····
posts - 19, comments - 53, trackbacks - 0, articles - 283
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

FreeMarker 中最常见的 undefined

Posted on 2009-07-09 09:50 Gavin.lee 阅读(3259) 评论(1)  编辑  收藏 所属分类: FreeMarker

500 Servlet Exception

freemarker.core.InvalidReferenceException: Expression s.expect is undefined
on line 7, column 11 in news/prize/open/ssc.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:209)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
	at freemarker.core.Environment.visit(Environment.java:416)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.Environment.visit(Environment.java:394)
	at freemarker.core.BodyInstruction.accept(BodyInstruction.java:93)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.Environment.visit(Environment.java:298)
	at freemarker.core.CompressedBlock.accept(CompressedBlock.java:73)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.EscapeBlock.accept(EscapeBlock.java:84)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.Macro$Context.runMacro(Macro.java:168)
	at freemarker.core.Environment.visit(Environment.java:602)
	at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.Environment.process(Environment.java:189)
	at freemarker.template.Template.process(Template.java:237)
	at yixun.wap.freemarker.FreemarkerDo.doMark(FreemarkerDo.java:47)
	at _jsp._page._news._prize._open._ssc__jsp._jspService(page/news/prize/open/ssc.jsp:41)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
	at com.caucho.jsp.Page.pageservice(Page.java:586)
	at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:190)
	at yixun.wap.filter.ReplaceTextFilter.doFilter(ReplaceTextFilter.java:77)
	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:73)
	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:167)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:226)
	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:477)
	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:591)
	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:513)
	at java.lang.Thread.run(Thread.java:619)


注:
由于freemarker强烈不支持null,所以这个问题呢,多半就是JSP(或抛数据源的地方)数据没有正确的传过来。究其原因,不在ftl模板。 MyEclipse控制台输出:一看知道哪个页面,哪行错了,so easy…… O(∩_∩)O~
[09:44:50.546] Compiling _jsp/_page/_news/_prize/_open/_ssc__jsp.java
[ERROR]
Expression s.expect is undefined on line 7, column 11 in news/prize/open/ssc.ftl.
The problematic instruction:
----------
==> ${s.expect} [on line 7, column 9 in news/prize/open/ssc.ftl]
 in user-directive f.page [on line 3, column 1 in news/prize/open/ssc.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression s.expect is undefined on line 7, column 11 in news/prize/open/ssc.ftl.
 at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
 at freemarker.core.Expression.getStringValue(Expression.java:118)
……
……

评论

# re: FreeMarker 中最常见的 undefined  回复  更多评论   

2012-03-26 12:49 by freemarker_tmp
freemarker报的这个错误真的好恶心....查了半天才查出来...或许对freemarker不熟悉吧.

只有注册用户登录后才能发表评论。


网站导航: