optiontransferselect标签
optiontransferselect标签左右各有一个列表,右边的选项可以转到左边,左边的选项也可以转到右边。optiontransferselect标签是利用两个<select>实现的。代码如下:
1 <struts:head theme="ajax" /> <!-- 使用Ajax主题 --> 2 3 <style type="text/css"> 4 body,td { 5 font-size: 12px; 6 } 7 select { 8 width: 120px; 9 } 10 </style> 11 </head> 12 13 <body> 14 <% 15 List<String> provinceSelected = new ArrayList<String>(); // 选中省份的List 16 17 provinceSelected.add("北京"); // 添加数据 18 provinceSelected.add("上海"); 19 provinceSelected.add("天津"); 20 provinceSelected.add("重庆"); 21 provinceSelected.add("河北"); 22 provinceSelected.add("河南"); 23 provinceSelected.add("山东"); 24 provinceSelected.add("山西"); 25 provinceSelected.add("江苏"); 26 provinceSelected.add("浙江"); 27 28 request.setAttribute("provinceSelected", provinceSelected); // 放到request中 29 30 List<String> provinceUnselected = new ArrayList<String>(); // 没有选中省份的List 31 32 provinceUnselected.add("湖南"); // 添加数据 33 provinceUnselected.add("湖北"); 34 provinceUnselected.add("云南"); 35 provinceUnselected.add("广东"); 36 provinceUnselected.add("广西"); 37 38 request.setAttribute("provinceUnselected", provinceUnselected); // 放到request中 39 %> 40 <struts:form action="login"> 41 <struts:optiontransferselect name="province" 42 doubleList="#request.provinceSelected" 43 list="#request.provinceUnselected" doubleName="city" leftUpLabel="向上" 44 leftDownLabel="向下" rightDownLabel="向下" rightUpLabel="向上" 45 leftTitle="已经选中的省份" headerKey="" headerValue="---请选择省份---" 46 rightTitle="剩余的省份" /> 47 </struts:form> 48 49 </body>