struts 标签 <html:select>怎么用呢?<%
List<Department> departs =  (List<Department>)request.getAttribute("departs");
%>想用上面这个LIST做为<html:selet>的选项。是用下面这种方式吗??请帮指点一下。<html:select name="" property="" multiple="true" size="5">
<html:options property="" labelProperty=""/>
</html:select>

解决方案 »

  1.   

    和平时的html的select标签差不多哈
      

  2.   

    给你个小例子:
     
    <html:select label="Pets"
            name="以name指定的key提交到服务器,和一般表单的name一样"
            list="集合"
            listKey="每个选项对应的key"
            listValue="每个选项对应的value"
            multiple="是否可以多选 true|false"
            size="高度  3"
     />
      

  3.   

    【select标签】
    【html:select标签】
    <html:select property="属性住" multiple="true" size="可选项的数目">
    <html:option value="对象.属性">显示值<html:option>
    <html:options collection="可选项的集合" property="可选项的Id值" labelProperty="可选项的显示值"><html:options>
    <html:optionsCollection name="可选项的集合" label="显示值的Id" value="显示值"></html:optionsCollection>
    </html:select>
    【s:select标签】
        1:使用简单集合生成下拉选择框
    <s:select name="a" label="--请选择--" list="{'选项值1','选项值2','选项值3'}">
    </s:select>
        2:使用Map对象生成下拉列表框
    <s:select name="b" label="--请选择--" labelposition="top" list="{'选项值1','选项值2','选项值3'}" listKey="key" listValue="value" />
        3:集合中放多个JavaBean实例生成下拉列表框
    <s:bean name="lee.BookService" id="bs" />
    <s:select name="b" label="--请选择--" labelposition="top" list="#bs.books" listKey="key" listValue="value" />
    这是我个人总结的,看能不能用上