Struts 2 FreeMarker 模板错误 stack.findValue('top') 未定义 [英] Struts 2 FreeMarker Template Error stack.findValue('top') is undefined

查看:40
本文介绍了Struts 2 FreeMarker 模板错误 stack.findValue('top') 未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还有一个关于 Struts2 的问题.

I have another question for Struts2.

我在做一个图表&一个数据表.发生在我的图表的第一次加载(并单击图表数据以链接到数据表)时,它工作正常.但是当我更改图表中的参数并想要重新填充数据表时,它给了我这个错误:

I was doing a chart & a datatable. What happens was on the first load of my chart (and clicking the chart data to link to a datatable), it works fine. But when I changed the parameter in my chart and wants to repopulate the datatable, it gives me this error:

Error on line 69, column 13 in template/simple/select.ftl
stack.findValue('top') is undefined.

不能分配给itemKey

It cannot be assigned to itemKey

==> assignment: itemKey=stack.findValue('top') [on line 69, column 13 in
template/simple/select.ftl]
in user-directive s.iterator [on line 59, column 1 in template/simple/select.ftl]

堆栈跟踪

freemarker.core.InvalidReferenceException: Error on line 69, column 13 in template/simple/select.ftl
stack.findValue('top') is undefined.
It cannot be assigned to itemKey
    at freemarker.core.Assignment.accept(Assignment.java:111)
    at freemarker.core.Environment.visit(Environment.java:210)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:210)
    at freemarker.core.IfBlock.accept(IfBlock.java:82)
    at freemarker.core.Environment.visit(Environment.java:210)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:210)
    at freemarker.core.Environment.visit(Environment.java:299)
    at freemarker.core.UnifiedCall.accept(UnifiedCall.java:130)
    at freemarker.core.Environment.visit(Environment.java:210)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:210)
    at freemarker.core.Environment.process(Environment.java:190)
    at freemarker.template.Template.process(Template.java:237)
    at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157)
    at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559)
    at org.apache.struts2.components.UIBean.end(UIBean.java:513)
    at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
    at org.apache.jsp.Annotate_jsp._jspx_meth_s_005fselect_005f9(Annotate_jsp.java:1086)
    at org.apache.jsp.Annotate_jsp._jspx_meth_s_005fform_005f0(Annotate_jsp.java:629)
    at org.apache.jsp.Annotate_jsp._jspService(Annotate_jsp.java:419)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja

我应该如何开始解决这个问题?

How should I start fixing this?

提前致谢:)

推荐答案

好的,我知道这是一个过时的问题,但尽管我努力寻找解决方案,以下是我通过链接找到的内容 这里:

OK I know that this is a backdated issue but as much as I struggled my way through looking for solutions, here's what I found through the link here:

在您面临的 List 中添加空值模板错误..

Null values added in List you are facing Template error..

如果你添加了,再次检查数据库或检查列表值空值会出现这个问题..

once again going to check the database or check List values if u added Null values this problem will come..

因此,我正在检查我的清单,砰!这是正确的 - 中间有空值,struts/freemaker 现在知道该怎么做.

Thus, I was checking through my list and bam! It was correct - There was null values inbetween and that struts/ freemaker did now know what to do.

我的解决方案是在我的 SQL 中,我选择了我想要的字段并确保,我添加了字段不为空".从那以后,我的页面工作得很好.

My solution was at my SQL, I selected the field I wanted and to make sure, I added "field IS NOT NULL". My page worked out fine happily ever after.

这篇关于Struts 2 FreeMarker 模板错误 stack.findValue('top') 未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆