struts2-UI标签

 1 <%@ page language="java" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
 2 <%@page import="java.util.List"%>
 3 <%@page import="java.util.ArrayList"%>
 4 <%@ taglib uri="/struts-tags"   prefix="s"%>
 5 <html>
 6   <head>
 7     <title>My JSP 'index.jsp' starting page</title>
 8     <meta http-equiv="description" content="page">
 9   </head>
10   <body>
11   
12      <s:form action="abcdaction" namespace="/abcd" method="post" id="form1" name="form1" >
13           <s:textfield label="用户名" value="zhangxx" id="username" name="username" ></s:textfield>
14        <s:password label="密码" value="888888" id="psw" name="psw" showPassword="true"></s:password>
15           <s:hidden label="隐藏" id="hidden" name="hidden"></s:hidden>
16          <s:label for="gender" value="male" label="性别"></s:label>
17          <s:textarea value="xxxxx" cols="10" rows="10" label="描述"></s:textarea> 
18          <!-- 
19              <input type="checkbox" name="java" value="01" id="form1_java"/>java
20           -->
21      <!--     <s:checkbox name="java" label="JAVA" fieldValue="01"></s:checkbox>
22          <s:checkbox name="c++" label="C++" fieldValue="02"></s:checkbox> -->
23      
24          <!-- checkboxlist标签构造map集合 -->
25          <!-- 
26              <input type="checkbox" name="list" value="01" id="list-1"/>java</label>
27             <input type="checkbox" name="list" value="02" id="list-2"/>php</label>
28             <input type="checkbox" name="list" value="03" id="list-3"/>.net</label>
29             <input type="checkbox" name="list" value="04" id="list-4"/>oracle</label>
30              
31              listkey:对应生成HTML代码后的,value属性
32              listvalue:对应生成HTML代码后的,后半部分文本内容
33              
34           -->
35          
36          <s:checkboxlist list="#{'01':'java','02':'php','03':'.net','04':'oracle'}" 
37              listKey="key" listValue="value" name="map" value="{'01','02'}" />
38               
39          <!-- checkboxlist标签构造list集合 -->
40          <s:checkboxlist list="{'java','.net','php'}" name="list" value="{'java','php'}"></s:checkboxlist>
41    
42          <!-- checkboxlist标签构造javabean -->
43          <s:checkboxlist list="%{#request.persons}" name="person"
44              listKey="id" listValue="name" value="{20,22,24,26,28,29,30}"></s:checkboxlist>
45           <!--  这里的listKey指的是,value值以该参考。listValue则为显示出来用哪个。id,name,age  -->
46          <!-- radio标签构造list集合 -->
47          <s:radio list="{'java','.net','php'}" name="list" value="'java'"></s:radio>
48      
49          <!-- radio标签构造list集合 radio只能选择一个 -->
50          <s:radio list="#{'01':'java','02':'php','03':'.net','04':'oracle'}"
51              listKey="key" listValue="value" name="map" value="'01'"></s:radio>
52              
53          <!-- radio标签构造javabean -->
54          <s:radio list="#request.persons" listKey="id" listValue="name" name="person" value="0"></s:radio>
55      
56          <!-- select标签构造list集合 -->
57          <s:select list="{'java','.net','php'}" name="list" value="'java'"></s:select>
58              
59          <!-- select标签构造map集合 -->
60          <s:select list="#{'01':'java','02':'php','03':'.net','04':'oracle'}"
61              listKey="key" listValue="value" name="map" value="'03'"></s:select>
62              
63          <!-- select标签构造javabean -->
64          <s:select list="#request.persons" listKey="id" listValue="name" name="person" value="8"></s:select>
65                   
66     
67          <s:submit type="input" value="确认"></s:submit>
68          <s:submit type="button" value="提交"></s:submit>
69          <s:submit type="image" value="图片"></s:submit>
70          <s:reset type="input" value="重置1"></s:reset>
71          <s:reset type="button" value="重置2"></s:reset>
72      </s:form> 
73   </body>
74 </html>

 

posted @ 2013-05-20 19:28  hacket520  阅读(220)  评论(0编辑  收藏  举报