struts2學習(9)struts標簽2(界面標簽、其他標簽)
阿新 • • 發佈:2017-07-05
orm char src w3c png har ace utf-8 ava
四、struts2界面標簽:
五、其他標簽:
1.界面標簽:
uiTag.jsp:
<body> <h>界面標簽</h> <hr/> <a href="ui/form.jsp" target="_blank">form標簽</a><br/> <a href="ui/text.jsp" target="_blank">文本標簽</a><br/> <a href="ui/radio.jsp" target="_blank"View Code>單選標簽</a><br/> <a href="ui/checkbox.jsp" target="_blank">復選框標簽</a><br/> <a href="ui/select.jsp" target="_blank">下拉框標簽</a><br/> </body>
form.jsp:
<body> <s:form action="hello" method="post" namespace="/foreground">View Code</s:form> </body>
text.jsp:
<body> 用戶名:<s:textfield name="userName"></s:textfield><br/> 密碼:<s:password name="password"></s:password><br/> 備註:<s:textarea name="desc"></s:textarea><br/> </body>View Code
radio.jsp:
<body> 性別:<s:radio list="#{0: ‘男 ‘, 1:‘女 ‘}" name="sex" value="0" /> </body>View Code
checkbox.jsp:
<body> 愛好:<s:checkboxlist list="#{0: ‘遊泳‘, 1:‘唱歌 ‘,2:‘跳舞‘}" name="hobby" value="1" /> </body>View Code
select.jsp:
<body> 愛好:<s:select list="#{0: ‘遊泳‘, 1:‘唱歌 ‘,2:‘跳舞‘}" name="hobby" value="1" multiple="true"/> </body>View Code
2. 其他標簽:
otherTag.jsp:
<body> <h>其他標簽</h> <hr/> <a href="other/updownselect.jsp" target="_blank">updownselect標簽</a><br/> <a href="other/optiontransferselect.jsp" target="_blank">optiontransferselect標簽</a><br/> </body>View Code
updownselect.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@taglib prefix="s" uri="/struts-tags" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <s:updownselect list="#{0:‘遊泳‘, 1:‘唱歌‘, 2:‘跳舞‘}" name="hobby" headerKey="-1" headerValue="請選擇" emptyOption="true" allowMoveUp="true" allowMoveDown="true" allowSelectAll="true" moveUpLabel="Move Up" moveDownLabel="Move Down" selectAllLabel="Select All" /> </body> </html>View Code
optiontransferselect.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@taglib prefix="s" uri="/struts-tags" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <s:optiontransferselect label="選擇你喜歡圖書" name="cnbook" leftTitle="中文圖書" list="{‘struts2權威指南‘,‘輕量級javaeye 企業應用空實戰‘,‘ajax講義‘}" doubleName="enBook" rightTitle="外文圖書" doubleList="{‘JavaScrip:The definitive Guide‘,‘export one-to-one‘}" multiple="true" addToLeftLabel="向左移動" addToRightLabel="向右移動" addAllToRightLabel="全部右移" addAllToLeftLabel="全部左移" allowSelectAll="true" headerKey="cnKey" headerValue="選擇圖書" emptyOption="true" doubleHeaderKey="enKey" doubleHeaderValue="選擇外文圖書" doubleMultiple="true" doubleEmptyOption="true" leftDownLabel="向下移動" rightDownLabel="向下移動" leftUpLabel="向上移動" rightUpLabel="向上移動" > </s:optiontransferselect> </body> </html>View Code
struts2學習(9)struts標簽2(界面標簽、其他標簽)