日期:2014-05-17  浏览次数:20720 次

struts2 的标签<s:select>获取不到list的问题
是这样的,我在jsp页面做一个下拉列表,下拉选项是从action后台读取数据库得到的list。
但是,页面报错:严重: Servlet.service() for servlet jsp threw exception
tag 'select', field 'list', name 'check': The requested list key 'list' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]

我的action:
private List<Code> list=new ArrayList<Code>();
// 省略list的set、get方法;
public String search()
{
    list=codeService.search("from com.model.Code c"); //获取list
    System.out.println(list.size());
     return "search";
}
我的jsp页面:
<s:select name="check" id="code" headerValue="--Please select--" headerKey="0"
          list="list" listkey="description" listvalue="serviceCode" />
配置文件都配置好了,我实在是找不到错误了额,请求帮忙?

------解决方案--------------------
Map<String, String> list
------解决方案--------------------
用map类型