为什么我下拉列表框取不到Action里的数据?
hbqhs 2010-10-21 04:57:51 从数据库取值放入<s:select/>中,没有出错,没有异常,就是下拉框中没有值,郁闷啊!
我以前没用过<s:select/>标签,大家帮我看下我用对了吗? 谢了
页面中:
<s:select list="sex" id="s" name="s" headerKey="0" headerValue="请选择" listKey="sexId" listValue="sexName" label="性别"></s:select>
Action类中:
private List<Sex> sex = new ArrayList<Sex>();
setSex getSex 属性 ……
public String execute() throws Exception {
List<Sex> sex = DAOFactory.getSexDAO().findAll();
System.out.println(sex.get(0).getSexName()); //输出发现sex中是有值的!
……
return SUCCESS;
}
实体类Sex中的属性:
private Integer sexId;
private String sexName;