请教一个struts2 <s:select> 抛异常的问题
【环境】
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>
------最佳解决方案--------------------day = new ArrayList();
Map