当前位置: 代码迷 >> Eclipse >> jsp 的select下拉列表有关问题请问
  详细解决方案

jsp 的select下拉列表有关问题请问

热度:102   发布时间:2016-04-23 14:39:27.0
jsp 的select下拉列表问题请教
我写了一个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是不是空的.
  相关解决方案