错误org.apache.jasper.JasperException: tag 'combobox', field 'list', name 'questionID': You must specify a collection/array/map/enumeration/iterator. Example: people or people.{name} - [unknown location】
JSP页面代码:
<s:property value="tip"/>
<s:form action="question.action">
<s:combobox list="#requestScope.QuestionTypeList"
label="问题类型"
listKey="key"
listValue="value"
name="questionID"
>
</s:combobox>
<s:textfield name="questionKye" label="关键字"></s:textfield>
<s:textarea name="content" cols="10" rows="5"></s:textarea>
<s:submit value="提问问题"></s:submit>
</s:form>
action代码:
public class QuestionAction extends ActionSupport{
private String content;
private String questionKye;
private Integer questionID;
private QuestionDao dao = new QuestionDaoImpl();
public String add() throws Exception {
return SUCCESS;
} public String prepare() throws Exception {
List list =dao.listQuestionType();
Map map = ActionContext.getContext().getSession();
map.put("QuestionTypeList", list);
return INPUT;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getQuestionKye() {
return questionKye;
}
public void setQuestionKye(String questionKye) {
this.questionKye = questionKye;
}
public Integer getQuestionID() {
return questionID;
}
public void setQuestionID(Integer questionID) {
this.questionID = questionID;
}
}
struts.xml代码
<action name="question" class="com.amaker.action.QuestionAction">
<result name="input">/Question.jsp</result>
</action>
跪求各位大虾帮帮忙 小弟在此感激不尽
JSP页面代码:
<s:property value="tip"/>
<s:form action="question.action">
<s:combobox list="#requestScope.QuestionTypeList"
label="问题类型"
listKey="key"
listValue="value"
name="questionID"
>
</s:combobox>
<s:textfield name="questionKye" label="关键字"></s:textfield>
<s:textarea name="content" cols="10" rows="5"></s:textarea>
<s:submit value="提问问题"></s:submit>
</s:form>
action代码:
public class QuestionAction extends ActionSupport{
private String content;
private String questionKye;
private Integer questionID;
private QuestionDao dao = new QuestionDaoImpl();
public String add() throws Exception {
return SUCCESS;
} public String prepare() throws Exception {
List list =dao.listQuestionType();
Map map = ActionContext.getContext().getSession();
map.put("QuestionTypeList", list);
return INPUT;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getQuestionKye() {
return questionKye;
}
public void setQuestionKye(String questionKye) {
this.questionKye = questionKye;
}
public Integer getQuestionID() {
return questionID;
}
public void setQuestionID(Integer questionID) {
this.questionID = questionID;
}
}
struts.xml代码
<action name="question" class="com.amaker.action.QuestionAction">
<result name="input">/Question.jsp</result>
</action>
跪求各位大虾帮帮忙 小弟在此感激不尽
label="问题类型"
listKey="key"
listValue="value"
name="questionID"
>
list里面的值要从action里面取吧 在action里面要有一个集合里面放你要的值