日期:2014-05-20  浏览次数:20651 次

struts 中 html:options 输出的 html 页面 怎么有多个 selected="selected"
jsp:
                <html:select   property= "selectedItems2 ">
                    <html:options   collection= "coll "   labelProperty= "name "   property= "id "   />  
                </html:select>

----------------------------

对应的   html   页码:
                <select   name= "selectedItems2 "> <option   value= "0 "> name0 </option>
<option   value= "1 "   selected= "selected "> name1 </option>    
<option   value= "2 "   selected= "selected "> name2 </option>
<option   value= "3 "   selected= "selected "> name3 </option>
<option   value= "4 "   selected= "selected "> name4 </option>     <!---怎么出现了   selected= "selected "     --->
<option   value= "5 "> name5 </option>
<option   value= "6 "> name6 </option>
<option   value= "7 "> name7 </option>
<option   value= "8 "> name8 </option>
<option   value= "9 "> name9 </option> </select>




------解决方案--------------------
<SELECT ID= "oSelect " NAME= "Cars " SIZE= "3 " MULTIPLE>
<OPTION VALUE= "1 " SELECTED> 宝马
<OPTION VALUE= "2 "> 保时捷
<OPTION VALUE= "3 " SELECTED> 奔驰
</SELECT>

------解决方案--------------------
<html:select property= "selectedItems2 ">
<html:optionsCollection property= "coll " label= "name " value= "id "/>
</html:select>