struts 下拉列表问题

来源:百度知道 编辑:UC知道 时间:2024/07/02 02:04:39
<html:select property="select" onchange="listChange();" >
<html:optionsCollection name="petTypeList" value="petPower" label="petTypeName" />

</html:select>

如何获得用户选中的对象?petTypeList是一个泛型集合 petPower和petTypeName是2个属性
<html:optionsCollection name="petTypeList" value="${petTypeList}" label="petTypeName" />
我想value里放该对象 为什么报错啊 请大家帮帮忙

参考下这个
deptid : <html:select property="deptid">
<html:options collection="depts" property="value" labelname="label"/>
</html:select>
里面的depts是个放这LabelValueBean对象的集合,这样在form里写个int deptid;就可以得到选中的这个值。

那是name或者property,不是value,看这句,你就知道value的作用了
<html:submit value="提交"/>