Action中的list和Jsp中的<s:select>标签怎么进行传值
1个回答
展开全部
1.很有可能你查出来的是空,所以没法循环
2.我测试了下,改动下Action代码
List<DptSelectBean> selectBeanList =new ArrayList<DptSelectBean>();
public List<DptSelectBean> getSelectBeanList() {
return selectBeanList;
}
public void setSelectBeanList(List<DptSelectBean> selectBeanList) {
this.selectBeanList = selectBeanList;
}
@Override
public String execute() throws Exception {
// selectBeanList = accountAddService.dptSelect();
DptSelectBean d1=new DptSelectBean();
d1.setDepartmentID(1);
d1.setDepartmentName("a");
DptSelectBean d2=new DptSelectBean();
d2.setDepartmentName("b");
d2.setDepartmentID(2);
selectBeanList.add(d1);
selectBeanList.add(d2);
// setSelectBeanList(selectBeanList);
return SUCCESS;
}
没有任何问题
2.我测试了下,改动下Action代码
List<DptSelectBean> selectBeanList =new ArrayList<DptSelectBean>();
public List<DptSelectBean> getSelectBeanList() {
return selectBeanList;
}
public void setSelectBeanList(List<DptSelectBean> selectBeanList) {
this.selectBeanList = selectBeanList;
}
@Override
public String execute() throws Exception {
// selectBeanList = accountAddService.dptSelect();
DptSelectBean d1=new DptSelectBean();
d1.setDepartmentID(1);
d1.setDepartmentName("a");
DptSelectBean d2=new DptSelectBean();
d2.setDepartmentName("b");
d2.setDepartmentID(2);
selectBeanList.add(d1);
selectBeanList.add(d2);
// setSelectBeanList(selectBeanList);
return SUCCESS;
}
没有任何问题
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询