主题 : 急急急FreeMarker template error!
级别: 举人
UID: 245
积分:79 加为好友
威望: 0 精华: 0
主题:9 回复:18
注册时间:2009-07-07
在线时长:0
1#   发表于:2009-07-07 16:56:20  IP:119.165.*.*
Expression item_index is undefined on line 21, column 59 in WEB-INF/user_base/jeecms_com_www/template/auxiliary/default/sys_VoteResult.html.
The problematic instruction:
----------
==> ${item_index+1} [on line 21, column 57 in WEB-INF/user_base/jeecms_com_www/template/auxiliary/default/sys_VoteResult.html]
----------
级别: 举人
UID: 245
积分:79 加为好友
威望: 0 精华: 0
主题:9 回复:18
注册时间:2009-07-07
在线时长:0
2#   发表于:2009-07-07 17:33:43  IP:119.165.*.*
我是在投票查看的时候遇到的这个错误!
级别: 举人
UID: 245
积分:79 加为好友
威望: 0 精华: 0
主题:9 回复:18
注册时间:2009-07-07
在线时长:0
3#   发表于:2009-07-09 09:18:46  IP:119.165.*.*
请问版主,我的这个问题怎么解决啊?
FreeMarker template error!

Expression item_index is undefined on line 21, column 59 in WEB-INF/user_base/jeecms_com_www/template/auxiliary/default/sys_VoteResult.html.
The problematic instruction:
----------
==> ${item_index+1} [on line 21, column 57 in WEB-INF/user_base/jeecms_com_www/template/auxiliary/default/sys_VoteResult.html]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression item_index is undefined on line 21, column 59 in WEB-INF/user_base/jeecms_com_www/template/auxiliary/default/sys_VoteResult.html.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.Expression.getStringValue(Expression.java:118)
at freemarker.core.AddConcatExpression._getAsTemplateModel(AddConcatExpression.java:96)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
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.IfBlock.accept(IfBlock.java:82)
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 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.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.ponyjava.common.struts2.interceptor.UrlInterceptor.doIntercept(Unknown Source)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.jeecms.core.web.CookieIdentityInterceptor.doIntercept(Unknown Source)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.ponyjava.common.struts2.interceptor.DomainNameInterceptor.doIntercept(Unknown Source)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:532)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
级别: 白丁
UID: 3
积分:2415 加为好友
威望: 0 精华: 0
主题:23 回复:1614
注册时间:2009-06-02
在线时长:0
4#   发表于:2009-07-09 09:36:08  IP:59.247.*.*
从出错信息来看应该是模板中的标签使用错误,item标签没定义
找到WEB-INF/user_base/jeecms_com_www/template/auxiliary/default/sys_VoteResult.html

检查第23行是否为:[#list bean.items as item]
item是否存在或写错
生命在于折腾!
级别: 举人
UID: 245
积分:79 加为好友
威望: 0 精华: 0
主题:9 回复:18
注册时间:2009-07-07
在线时长:0
5#   发表于:2009-07-09 10:55:26  IP:119.165.*.*
我什么都没有改啊,这是源文件,请版主看看是咋回事。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head xmlns="">
    <title>投票结果 - ${web.name} - powered by jeecms</title>
    <meta content="text/html; charset=gb2312" http-equiv="Content-Type" />
    <meta content="投票结果" name="keywords" />
    <meta content="投票结果" name="description" /><style type="text/css">
body{margin:10px 0px;padding:0px;font-size:12px;font-family:verdana;}</style>
  </head>
  <body xmlns="">
    [#if error??] ${error} [#else]
    <table cellspacing="1" cellpadding="5" width="98%" align="center" bgcolor="#5aadf6" border="0">
      <tbody>
        <tr>
          <td bgcolor="#aad5fb" colspan="2" height="25"><strong>投票主题:${bean.title}</strong></td>
        </tr>
        <tr>
          <td bgcolor="#ffffff" colspan="2" height="25">投票总人数:${bean.totalCount}</td>
        </tr>
        <tr>
          <td width="256" bgcolor="#ffffff" height="25">${item_index+1}、${item.title}</td>
          <td width="719" bgcolor="#ffffff"><img height="10" width="${item.percent}%" border="0" alt="" src="${root}/default/auxiliary/img/vote/vote_bar.gif" />${item.percent}%(${item.voteCount})</td>
        </tr>
      </tbody>
    </table>
    [/#if]
  </body>
</html>
级别: 秀才
UID: 808
积分:65 加为好友
威望: 0 精华: 0
主题:2 回复:40
注册时间:2009-09-15
在线时长:0
6#   发表于:2009-10-30 12:16:31  IP:218.92.*.*
我的也出过此问题,将原始的sys_VoteResult.html文件在同位置覆盖解决
1 共1页