struts2 select 标签的如何设置 option 选中

解决方案 »

  1.   

    <select name="myselect">
    <option value="1"></option>
    <option value="2" selected></option>
    <option value="3"></option>
    </select>
      

  2.   

    <select name="myselect"> 
    <option value="1"> </option> 
    <option value="2" selected> </option> 
    <option value="3"> </option> 
    </select>
      

  3.   


    <html:select property="ware.wareSort.waresortId" >
    <c:forEach items="${wsList}" var="wsList">
        <html:option value="${wsList.twoId }" >${wsList.oneName }|${wsList.twoName }</html:option>
      
      </c:forEach> 
    </html:select>
    我是struts标签
      

  4.   

    可以在 <html:selected property="XXX">这里加上value。 <html:selected property="XXX" value="abc"> 
      <html:option value="123">xxx </html:option> 
      <html:option value="abc">xxx </html:option> 
      <html:option value="ddd">xxx </html:option> 
    </html:selected> 这样,当匹配到时就选中了 
      

  5.   

    <s:select name="sex" list="#{'1':'男', '2':'女'}" value="1" />