我在struts-2中使用<s:select>
multiple="true"
,但它提供了一个例外。如果我删除multiple="true"
,那么它运行良好。我无法理解错误。
我的JSP页面:
<div id="form" style="text-align: center;">
<s:select id="list" size="3" multiple="true" list="{'Jan', 'Feb', 'Mar', 'Apr'}"></s:select>
<button id="submit" type="submit">Submit</button>
</div>
例外是:
org.apache.jasper.JasperException: Expression parameters.name is undefined on line 92, column 85 in template/simple/select.ftl. - Class: freemarker.core.TemplateObject
File: TemplateObject.java
Method: assertNonNull
Line: 124 - freemarker/core/TemplateObject.java:124:-1
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:585)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
root cause
Expression parameters.name is undefined on line 92, column 85 in template/simple/select.ftl. - Class: freemarker.core.TemplateObject
File: TemplateObject.java
Method: assertNonNull
Line: 124 - freemarker/core/TemplateObject.java:124:-1
org.apache.struts2.components.UIBean.end(UIBean.java:521)
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
org.apache.jsp.index_jsp._jspx_meth_s_005fselect_005f0(index_jsp.java:300)
org.apache.jsp.index_jsp._jspService(index_jsp.java:171)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
root cause
freemarker.core.InvalidReferenceException: Expression parameters.name is undefined on line 92, column 85 in template/simple/select.ftl.
freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
freemarker.core.Expression.getStringValue(Expression.java:118)
freemarker.core.Expression.getStringValue(Expression.java:93)
freemarker.core.StringBuiltins$StringBuiltIn._getAsTemplateModel(StringBuiltins.java:71)
freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
freemarker.core.Expression.getStringValue(Expression.java:93)
freemarker.core.DollarVariable.accept(DollarVariable.java:76)
freemarker.core.Environment.visit(Environment.java:210)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:210)
freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
freemarker.core.Environment.visit(Environment.java:210)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:210)
freemarker.core.Environment.include(Environment.java:1483)
freemarker.core.Include.accept(Include.java:169)
freemarker.core.Environment.visit(Environment.java:210)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:210)
freemarker.core.Environment.process(Environment.java:190)
freemarker.template.Template.process(Template.java:237)
org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157)
org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:565)
org.apache.struts2.components.UIBean.end(UIBean.java:519)
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
org.apache.jsp.index_jsp._jspx_meth_s_005fselect_005f0(index_jsp.java:300)
org.apache.jsp.index_jsp._jspService(index_jsp.java:171)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
答案 0 :(得分:0)
抱歉,伙计们......我得到了答案。
我必须在我的选择列表中提供 名称 。