<html:form action="demo.do"
method="post">
性別:
<html:radio property="sex" value="男"/>男
<html:radio property="sex"
value="女"/>女
<br>
<html:submit
value="提交"/>
<html:reset
value="重置"/>
</html:form>
à
<html:form action="demo.do"
method="post">
選擇所喜歡的城市:
<html:select property="city">
<html:option
value="BJ">北京</html:option>
<html:option
value="TJ">天津</html:option>
<html:option
value="NJ">南京</html:option>
<html:option
value="GD">廣東</html:option>
<html:option
value="DB">東北</html:option>
</html:select>
<br>
<html:submit
value="提交"/>
<html:reset
value="重置"/>
</html:form>
à
<body>
<%
Collection
col = new ArrayList() ;
col.add(new
org.apache.struts.util.LabelValueBean("北京","BJ")) ;
col.add(new
org.apache.struts.util.LabelValueBean("天津","TJ")) ;
col.add(new
org.apache.struts.util.LabelValueBean("南京","NJ")) ;
col.add(new
org.apache.struts.util.LabelValueBean("東北","DB")) ;
col.add(new
org.apache.struts.util.LabelValueBean("廣東","GD")) ;
//
將全部的集合放在一個(gè)屬性范圍之中
pageContext.setAttribute("ht",col)
;
%>
<html:form action="demo.do" method="post">
選擇所喜歡的城市:
<html:select
property="city">
<html:optionsCollection name="ht"/>
</html:select>
<br>
<html:submit
value="提交"/>
<html:reset
value="重置"/>
</html:form>
</body>
à
<body>
<html:form action="demo.do" method="post">
選擇所愛(ài)吃的水果:
<html:checkbox property="fruit"
value="orange"/>橘子
<html:checkbox property="fruit"
value="banana"/>香蕉
<html:checkbox property="fruit"
value="apple"/>蘋(píng)果
<html:checkbox property="fruit"
value="watermelon"/>西瓜
<html:checkbox property="fruit"
value="cherry"/>櫻桃
<br>
<html:submit
value="提交"/>
<html:reset
value="重置"/>
</html:form>
</body>
à
<body>
<html:form action="demo.do" method="post">
選擇所愛(ài)吃的水果:
<logic:iterate id="fru"
name="demoForm" property="fruit">
<html:multibox
property="select">${fru}</html:multibox>${fru}
</logic:iterate>
<br>
<html:submit
value="提交"/>
<html:reset
value="重置"/>
</html:form>
</body>
à
<body>
<html:form action="demo.do" method="post">
個(gè)人介紹:
<html:textarea
property="sex" rows="6" cols="30"/>
<br>
<html:submit
value="提交"/>
<html:reset
value="重置"/>
</html:form>
</body>
--
學(xué)海無(wú)涯