【环境】
eclipse7.5 JRE7 J2EE1.4 tomcat7【异常】
严重: Servlet.service() for servlet [jsp] in context with path [/Cyril] threw exception [tag 'select', field 'list', name 'daysname': The requested list key 'day' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]] with root cause
tag 'select', field 'list', name 'daysname': The requested list key 'day' 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:240)
at org.apache.struts2.components.Component.findValue(Component.java:361)
at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80)
...【struts.xml】
...
<action name="selectTag" class="selectTag.weekDay">
<result>/selectTag.jsp</result>
</action>
...【action】
package selectTag;import java.util.ArrayList;
import java.util.List;import com.opensymphony.xwork2.ActionSupport;public class weekDay extends ActionSupport { private static final long serialVersionUID = 4975664076692544549L;
private List day = new ArrayList(); public void prepare() throws Exception {
//初始化list
day = new ArrayList();
day.add("Sunday");
day.add("Monday");
day.add("Tuesday");
day.add("Wednesday");
day.add("Thursday");
day.add("Friday");
day.add("Saturday");
} public String execute() throws Exception {
return SUCCESS;
} public List getDay() {
return this.day;
}
}【jsp】
<%@ page contentType="text/html;charset=GBK" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s" %><html>
<head>
<title>SelectTag</title>
</head>
<body>
<s:form action="selectTag">
<s:select label="Select WeekDay"
name="daysname"
headerKey="1"
headerValue="-- Please Select --"
list="day"
/>
<s:select label="Select Month"
name="monthname"
headerKey="1"
headerValue="-- Please Select --"
list="#{'01':'January','02':'February','03':'March','04':'April',
'05':'May','06':'June','07':'July','08':'August','09':'September','10':
'October','11':'November','12':'December'}"
/>
</s:form>
</body>
</html>
eclipse7.5 JRE7 J2EE1.4 tomcat7【异常】
严重: Servlet.service() for servlet [jsp] in context with path [/Cyril] threw exception [tag 'select', field 'list', name 'daysname': The requested list key 'day' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]] with root cause
tag 'select', field 'list', name 'daysname': The requested list key 'day' 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:240)
at org.apache.struts2.components.Component.findValue(Component.java:361)
at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80)
...【struts.xml】
...
<action name="selectTag" class="selectTag.weekDay">
<result>/selectTag.jsp</result>
</action>
...【action】
package selectTag;import java.util.ArrayList;
import java.util.List;import com.opensymphony.xwork2.ActionSupport;public class weekDay extends ActionSupport { private static final long serialVersionUID = 4975664076692544549L;
private List day = new ArrayList(); public void prepare() throws Exception {
//初始化list
day = new ArrayList();
day.add("Sunday");
day.add("Monday");
day.add("Tuesday");
day.add("Wednesday");
day.add("Thursday");
day.add("Friday");
day.add("Saturday");
} public String execute() throws Exception {
return SUCCESS;
} public List getDay() {
return this.day;
}
}【jsp】
<%@ page contentType="text/html;charset=GBK" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s" %><html>
<head>
<title>SelectTag</title>
</head>
<body>
<s:form action="selectTag">
<s:select label="Select WeekDay"
name="daysname"
headerKey="1"
headerValue="-- Please Select --"
list="day"
/>
<s:select label="Select Month"
name="monthname"
headerKey="1"
headerValue="-- Please Select --"
list="#{'01':'January','02':'February','03':'March','04':'April',
'05':'May','06':'June','07':'July','08':'August','09':'September','10':
'October','11':'November','12':'December'}"
/>
</s:form>
</body>
</html>
解决方案 »
- 为什么访问工程项目文件报错404?
- 提问,有人使用过Jsoup吗,遇到一个选择标签的问题,进来帮看看,谢谢
- jfreechart热点
- birt 标签在JSP页面的使用
- 有谁用移动的API弄过彩信开发? 这个网关模拟器MMSCSimulation.exe应该如何配置才能正常运行?
- struts+hibernate+spring架构是怎样搭建的
- 谁有高质量的源码项目!!都进来看看吧->进来吧
- TOMCAT死掉的问题,已经跟踪1周了,太郁闷了,忘各路大虾指点
- 请问有什么好用的编写jsp的工具么?
- 求救!!!不胜感激!
- tomcat远程无法访问
- 高手来看,运行seam3例子时遇到的错误,还有一个100分的贴一起结贴
Map m1 = new HashMap();
m1.put("1","Sunday")
day.add(m1);
org.apache.jasper.JasperException: tag 'select', field 'list', name 'daysname': The requested list key 'day' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
...