Cyh的博客

Email:kissyan4916@163.com
posts - 26, comments - 19, trackbacks - 0, articles - 220

STRUTS标签

Posted on 2009-02-16 19:40 啥都写点 阅读(140) 评论(0)  编辑  收藏 所属分类: J2EE

<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")) ;

       // 将全部的集合放在一个属性范围之中

       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">

              选择所爱吃的水果:

                     <html:checkbox property="fruit" value="orange"/>橘子

                     <html:checkbox property="fruit" value="banana"/>香蕉

                     <html:checkbox property="fruit" value="apple"/>苹果

                     <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">

              选择所爱吃的水果:

                     <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">

              个人介绍:

                     <html:textarea property="sex" rows="6" cols="30"/>

                     <br>

                     <html:submit value="提交"/>

                     <html:reset value="重置"/>

       </html:form>

 </body>



                                                                                                       --    学海无涯
        


只有注册用户登录后才能发表评论。


网站导航: