Struts 2 FreeMarker模板错误stack.findValue('top')未定义和jsp页面

时间:2012-08-01 06:50:07

标签: mysql eclipse jsp struts2

Struts 2 FreeMarker模板错误stack.findValue('top')未定义且jsp页面

Error on line 69, column 13 in template/simple/select.ftl
stack.findValue('top') is undefined.
It cannot be assigned to itemKey
The problematic instruction:
---- ------
==> 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]
in include "/${parameters.templateDir}/simple/select.ftl" [on line 24, column 1 in    
template/xhtml/select.ftl]
----------    
Java backtrace for programmers:
----------
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:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:221)

基本上在我的JSP端我有很多下拉选项。 如何解决这个错误.... !!!!

用于下拉列表的JSP PAGE等等....

    <html>
    <title>JSP PAGE</title>
    <body>
<s:form action="event" namespace="/" method= "post">
<h4>
        <s:textfield name="description" label="Description" size="30" />
</h4>
<h4>
        <s:textfield name="name" label="Name" />
</h4>
<h4>
    <sx:datetimepicker name="date" label="Format (DD-MM-YYYY)"              
            displayFormat="dd-MMM-yyyy" value="%{'2012-01-01'}">
    </sx:datetimepicker>
</h4>
<h4>
    <s:textfield name="type" label="Event Type" />
</h4>
<h4>
    <s:textfield name="group" label="Event Group" />
</h4>
    <s:select name="Location" headerKey="-1" label="Location" list="{cityList}">
<%-- <s:iterator value="cityList">
<option>
</option>
</s:iterator> --%>
</s:select>
    <s:submit value="Submit" method="execute" key="submit" align="center" />
</s:form>
    </body>
    </html>

1 个答案:

答案 0 :(得分:2)

删除下拉列表中的所有空(null)值,它指的是这些值。这将解决您的问题。