第一、显示一个下拉列表与从别的页面跳转过来没有关系
第二、从数据库中获得数据,你应该在Action里面取得数据后,将数据放到Request里面
第三、数据取出来后放在一个List或Collection或Map里面,我习惯用List
第四、从List或其它的容器中取数据应该用<html:options> 或<html:optionsCollection>
第五、<html:options> 和<html:optionsCollection>外层必须用<html:select property="">,所以这个属性你必须在FormBean里定义
第六、由于你要用到这些标签,所以你必须定义FormBean
第七、示例:
1、从Action取数据,以List为例
List list = xxxxx;//从数据库中取得下拉列表中的数据
request.setAttribute("list",list);
2、在页面显示
<html:form action="xxxx">
...
  <html:select property="xxx">
    <html:options collection="list" labelProperty="下拉框中显示的内容,一般是name或其它相似属性" property="各选项对应的值,一般是id" />
  </html:select>
...
</html:form>

解决方案 »

  1.   

    html:select 本身就是个比较差的方案,使用 JSTL 解决更灵活和舒服些,楼主有兴趣吗?
      

  2.   

    Collection的内容给网页生成View时读取呀
      

  3.   

    在你的ACTION    <td>
       <html:select property="provinceId" style="width:110px" styleClass="selectfield">
                       <html:option value="">省份</html:option>
                     <html:optionsCollection name="LogManagerFrm" property="beanCollection" styleClass="selectfield"/>
    </html:select>
       </td>
      

  4.   

    在你的ACTION    <td>
    在你的ACTION里哪到省份列表,然后在你的FORMBEAN里定义一个private beanCollection,并且要把FORMBEAN放到REQUEST里,就是 REQUEST.GETATTRIBUTE("FORMNAME",FORMBEAN) ;
    然后在JSP里定义如下:
    <html:select property="provinceId" style="width:110px" styleClass="selectfield">
                       <html:option value="">省份</html:option>
                     <html:optionsCollection name="LogManagerFrm" property="beanCollection" styleClass="selectfield"/>
    </html:select>
       </td>
    如果是多个,你可以定义多个 beanCollection,例如beanCollection1,只要把JSP的 PROPERTY里的值改成相应的就可以了!