当前位置: 代码迷 >> Java Web开发 >> Struts2 <s:select/>有关问题
  详细解决方案

Struts2 <s:select/>有关问题

热度:9346   发布时间:2013-02-25 21:10:06.0
Struts2 <s:select/>问题
(抱歉我不知道截图怎么上传...您凑活看....)
下方是问题的主要原因:
<s:select list="%{#request.usersMessageList}" label="收件人" name="senderid" listKey="suid" listValue="username" emptyOption="true"/>
下面是报的错:
2012-10-8 19:14:05 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [jsp] in context with path [/Unit3SSH] threw exception [tag 'select', field 'list', name 'senderid': The requested list key '%{#request.usersMessageList}' 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 'senderid': The requested list key '%{#request.usersMessageList}' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
我的list里面装的是map对象,里面是hashmap<ingter,String>();

可以在页面显示出来列表的东西。但是一提交就会出现以上的错误。

以下是action:
public class MailAction extends ActionSupport {

private MailService mailService;

public void setMailService(MailService mailService) {
this.mailService = mailService;
}

public String usersList() {
ServletActionContext.getRequest().setAttribute("usersMessageList",
mailService.UserMap());
return "userslist";
}
我感觉可能是由于action的错,可自己费尽心思也想不出来,求大家帮帮我,我会结账的,我也会即使回复您的。谢谢

------解决方案--------------------------------------------------------
解决了就好,最好在结贴时写上如何解决的!
  相关解决方案