我写了一个jsp,中间用到select下来列表。我是通过动态复制的。写法如下:
<select id= "locationTypeSelect " name= "locationTypeSelect " dataType= "Require ">
<option value= " "> 请选择 </option>
<%=locationTypeOptions%>
</select> </td>
我的变量locationTypeOptions是如下处理的:
String locationTypeOptions= " ";
if (locationTypes!=null){
for(Iterator locationTypeIte=locationTypes.iterator();locationTypeIte.hasNext();)
{
LocationTypeVO locationTypeVOs=(LocationTypeVO)locationTypeIte.next();
locationTypeOptions+= " <option value= "+locationTypeVOs.locationType+ "> "+locationTypeVOs.description+ " </option> ";
}
}
locationTypes是从action中传入的collection,是有数据的。
我的页面做完后,下拉列表中能看到locationTypes中的description,但无论选中哪一个,该select下拉框的value都为null。请问这是为什么呢?我还有哪个地方做得部队呢?谢谢
------解决方案--------------------
Ajax实现二级联动下拉框
http://www.blogjava.net/rickhunter/articles/46582.html
------解决方案--------------------
<selet id= "locationTypeSelect " name= "locationTypeSelect " dataType= "Require>
<optionCollect name= " " id= " " value= " " type= " "/>
</select>
好像是这样的,刚关了eclipse,懒的再去开了
------解决方案--------------------
关注,学习
------解决方案--------------------
locationTypes是有数据,locationTypeVOs.locationType有数据吗?
看一下生成的静态页面的source,看看value是不是空的.