几个辅助类: package lee;public class Book...{ private String name; private String author; public Book() ...{ } public Book(String name , String author) ...{ this.name = name; this.author = author; } public void setName(String name) ...{ this.name = name; } public String getName() ...{ return this.name; } public void setAuthor(String author) ...{ this.author = author; } public String getAuthor() ...{ return this.author; }} package lee;public class BookService...{ public Book[] getBooks() ...{ return new Book[] ...{ new Book("Spring2.0宝典","张三"), new Book("轻量级J2EE企业应用实战","李四"), new Book("基于J2EE的Ajax宝典","王五") }; }} <%...@ page language="java" contentType="text/html; charset=GBK"%><%...@taglib prefix="s" uri="/struts-tags"%><html> <head><s:head/> <title>成功页面</title> </head> <body> checkboxList标签:<br> <s:form> <!-- 使用简单集合来生成多个复选框 --> <s:checkboxlist name="bookList" label="请选择你喜欢的技术" list="{'spring','hibernate','struts'}" labelposition="left"> </s:checkboxlist> <!-- 使用简单Map对象来生成多个复选框 --> <s:checkboxlist name="bookMap" label="请选择你喜欢的出版日期" list="#{'spring':'2006','hibernate':'2007','struts':'2008'}" labelposition="left" listKey="key" listValue="value"> </s:checkboxlist> <!-- 使用集合里放多个JavaBean实例来生成多个复选框 --> <s:bean name="lee.BookService" id="bs"></s:bean> <s:checkboxlist name="bookBean" label="请选择你喜欢的图书" list="#bs.books" labelposition="left" listKey="author" listValue="name"> </s:checkboxlist> </s:form> <s:form> combobox标签:combox标签中的下拉菜单和selcet不同,此仅为帮助输入而设计<br> <s:combobox list="{'spring','hibernate','struts'}" size="100" maxlength="20" name="bookcombo" ></s:combobox> </s:form> <s:form theme="simple"> 日期选择部件,指定toggleType属性,且指定value="today"<br> <s:datetimepicker name="order.date" label="购买日期" toggleType="explode" value="today"/><hr> 日期选择部件,指定了format属性<br> <s:datetimepicker name="order.date" label="购买日期" displayFormat="yyyy年MM月dd日"/><hr> 日期选择部件,指定了weekStartsOn属性<br> <s:datetimepicker name="order.date" label="购买日期" displayFormat="yyyy年MM月dd日" weekStartsOn="1"/><hr> 时间选择部件<br> <s:datetimepicker label="选择出发时间" type="time" /><hr> </s:form> <s:form action="x"> 使用doubleselect,必须指定form的action属性 支持两项的doubleselect列表框 <s:doubleselect label="请选择您喜欢的图书" name="author" list="{'张三', '李四','王五'}" doubleList="top == '张三' ? {'struts', 'spring' , 'hibernate'} : {'struts2','spring2.0','hibernate3.0'}" doubleName="book"/> 支持多项的doubleselect列表框 <s:set name="bs" value="#{'张三':{'struts1', 'spring1' , 'hibernat1'},'李四':{'struts2', 'spring2' , 'hibernate2'},'王五':{'struts3', 'spring3' , 'hibernate3'}}"></s:set> <s:doubleselect label="请选择您喜欢的图书" name="authora" list="#bs.keySet()" doubleList="#bs[top]" doubleName="booka"/></s:form><s:form theme="simple">optiontransferselect标签使用doubleList指定第二个list的内容,list指定第一个list的内容<s:optiontransferselect doubleList="{'struts','spring','hibernate'}" list="{'struts2','spring2','hibernate2'}" doubleName="2book" name="1book" leftTitle="升级版" rightTitle="普通版" multiple="true" doubleMultiple="true" addToLeftLabel="向左移动" addToRightLabel="向右移动" selectAllLabel="全部选择" addAllToRightLabel="全部向右移动" addAllToLeftLabel="全部向左移动" emptyOption="true" headerKey="1key" headerValue="版本1图书" doubleHeaderKey="2key" doubleHeaderValue="版本2图书" doubleEmptyOption="true"></s:optiontransferselect></s:form><s:form theme="simple"> select标签:使用简单集合 <s:select list="{'struts','spring','hibernate'}" name="a" multiple="true"></s:select><br> select标签:使用map集合 <s:select list="#{'zhangsan':'struts','lisi':'spring','wangwu':'hibernate'}" name="b" multiple="true" listKey="value" listValue="key"></s:select><br> select标签:使用集合里放多个javabean实例来生成下拉选择框 <s:bean name="lee.BookService" id="bs"/> <s:select list="#bs.books" name="c" listKey="name" listValue="author"></s:select></s:form><s:form theme="simple"> radio标签:使用简单集合 <s:radio list="{'struts','spring','hibernate'}" name="a"></s:radio><br> radio标签:使用map集合 <s:radio list="#{'zhangsan':'struts','lisi':'spring','wangwu':'hibernate'}" name="b" listKey="value" listValue="key"></s:radio><br> radio标签:使用集合里放多个javabean实例来生成下拉选择框 <s:bean name="lee.BookService" id="bs"/> <s:radio list="#bs.books" name="c" listKey="name" listValue="author"></s:radio></s:form><s:form theme="simple"> optgroup标签,用于和select标签组合 <s:select list="#{'zhangsan':'struts','lisi':'spring','wangwu':'hibernate'}" name="a" listKey="value" listValue="key"> <s:optgroup label="Rob" list="#{'jialiu':'ibatis','songqi':'xml'}" listKey="value" listValue="key"></s:optgroup> <s:optgroup label="Ror" list="#{'liuwi':'freemarker','ren1':'velocity'}" listKey="value" listValue="key"></s:optgroup> </s:select></s:form><s:form theme="simple"> updownselect标签:使用简单集合对象生成可上下移动选项的列表框 <s:updownselect name="ac" list="{'struts','spring','hibernate'}"></s:updownselect><br> updownselect标签:使用map集合对象生成可上下移动选项的列表框 <s:updownselect list="#{'zhangsan':'struts','lisi':'spring','wangwu':'hibernate'}" name="bc" moveDownLabel="向下移动" moveUpLabel="向上移动" listKey="value" listValue="key" emptyOption="true"></s:updownselect><br> updownselect标签:使用集合里放多个javabean实例来生成下拉选择框 <s:bean name="lee.BookService" id="bs"/> <s:updownselect list="#bs.books" name="cc" selectAllLabel="全部选择" multiple="true" listKey="name" listValue="author" moveDownLabel="向下移动" moveUpLabel="向上移动"></s:updownselect></s:form> </body></html>