Struts2标签select菜单栏

  1 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
  2 <%@taglib prefix="s" uri="/struts-tags" %>
  3 
  4 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  5 <html>
  6   <head>
  7     <title>My JSP 'index3.jsp.jsp' starting page</title>
  8     
  9     <meta http-equiv="pragma" content="no-cache">
 10     <meta http-equiv="cache-control" content="no-cache">
 11     <meta http-equiv="expires" content="0">    
 12     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
 13     <meta http-equiv="description" content="This is my page">
 14     <!--
 15     <link rel="stylesheet" type="text/css" href="styles.css">
 16     -->
 17 
 18   </head>
 19   
 20   <body>
 21     <h3>使用name和list属性,list属性的值是一个列表</h3>
 22 
 23 <s:form>
 24 
 25     <s:select label="最高学历" name="education" list="{'高中','大学','硕士','博士'}"/>
 26 
 27 </s:form>
 28 
 29  
 30 
 31 <h3>使用name和list属性,list属性的值是一个Map</h3>
 32 
 33 <s:form>
 34 
 35     <s:select label="最高学历" name="education" list="#{1:'高中',2:'大学',3:'硕士',4:'博士'}"/>
 36 
 37 </s:form>
 38 
 39  
 40 
 41 <h3>使用headerKey和headerValue属性设置header选项</h3>
 42 
 43 <s:form>
 44 
 45     <s:select label="最高学历" name="education" list="{'高中','大学','硕士','博士'}"
 46 
 47        headerKey="-1" headerValue="请选择您的学历"/>
 48 
 49 </s:form>
 50 
 51  
 52 
 53  
 54 
 55 <h3>使用emptyOption属性在header选项后添加一个空的选项</h3>
 56 
 57 <s:form>
 58 
 59     <s:select label="最高学历" name="education" list="{'高中','大学','硕士','博士'}"
 60 
 61        headerKey="-1" headerValue="请选择您的学历"
 62 
 63        emptyOption="true"/>
 64 
 65 </s:form>
 66 
 67  
 68 
 69  
 70 
 71 <h3>使用multiple属性设置多选</h3>
 72 
 73 <s:form>
 74 
 75     <s:select label="最高学历" name="education" list="{'高中','大学','硕士','博士'}"
 76 
 77        headerKey="-1" headerValue="请选择您的学历"
 78 
 79        emptyOption="true"
 80 
 81        multiple="true"/>
 82 
 83 </s:form>
 84 
 85  
 86 
 87 <h3>使用size属性设置下拉框可显示的选项个数</h3>
 88 
 89 <s:form>
 90 
 91     <s:select label="最高学历" name="education" list="{'高中','大学','硕士','博士'}"
 92 
 93        headerKey="-1" headerValue="请选择您的学历"
 94 
 95        emptyOption="true"
 96 
 97        multiple="true" size="8"/>
 98 
 99 </s:form>
100 
101  </body>
102 </html>

 

posted @ 2013-05-21 16:30  hlb  阅读(179)  评论(0编辑  收藏  举报