2 回答
TA贡献2065条经验 获得超13个赞
使用 <html:optionsCollection> 标签
1)在ActionForm中加入字段
private List cityList=new ArrayList();
2)加入必须的getter方法
public List getCityList() {
return cityList;
}
3)在reset方法内给cityList填充内容
cityList.add(new LabelValueBean( "北京市 ", "010 "));
cityList.add(new LabelValueBean( "广州市 ", "020 "));
cityList.add(new LabelValueBean( "上海市 ", "021 "));
4)JSP标签中使用
<html:select property= "city2 ">
<html:optionsCollection property= "cityList " label= "label " value= "value "/>
</html:select>
TA贡献1836条经验 获得超4个赞
<html:form action= " " >
<html:select property= "tt " >
<logic:iterate id= "bbc " name= "array ">
<option value= "${bbc} "> <bean:write name= "bbc "/> </option>
</logic:iterate>
</html:select>
</html:form>
添加回答
举报