Struts 2选择标记返回“请求的列表键'X'无法解析为集合/数组/映射/枚举/迭代器类型”

时间:2011-03-28 11:08:41

标签: struts2

我是Struts 2的初学者。我正在尝试this site的示例。然后我尝试在eclipse中执行代码,但是我遇到了错误。

我得到的错误如下:

SEVERE: Servlet.service() for servlet jsp threw exception
tag 'select', field 'list', name 'yourSearchEngine': The requested list key 'searchEngine' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
    at org.apache.struts2.components.Component.fieldError(Component.java:237)
    at org.apache.struts2.components.Component.findValue(Component.java:358)
    at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80)
    at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105)
    at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:856)
    at org.apache.struts2.components.UIBean.end(UIBean.java:510)
    at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
    at org.apache.jsp.Select_jsp._jspx_meth_s_005fselect_005f0(Select_jsp.java:166)
    at org.apache.jsp.Select_jsp._jspx_meth_s_005fform_005f0(Select_jsp.java:113)
    at org.apache.jsp.Select_jsp._jspService(Select_jsp.java:71)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
    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:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    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:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)

2 个答案:

答案 0 :(得分:0)

The requested list key 'searchEngine' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location] at 

问题在于此处,请求中没有searchEngine列表

你是如何“执行”这个例子的?

答案 1 :(得分:0)

确保在显示之前确实将数据填充到select标记中。我的意思是尝试将数据填充到动作类本身的select标记中。获取请求类中的列表,并将该列表名称作为list属性传递给该选择标记。