⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 strus 2的新表单标志的使用 - max on java - blogjava.htm

📁 struts2标签的详细解释说明教程
💻 HTM
📖 第 1 页 / 共 5 页
字号:
style="COLOR: #ff0000">&amp;gt;</SPAN><SPAN 
style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">h2</SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; &nbsp; 
</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN 
style="COLOR: #800000">s:form </SPAN><SPAN 
style="COLOR: #ff0000">action</SPAN><SPAN 
style="COLOR: #0000ff">="Store"</SPAN><SPAN style="COLOR: #ff0000"> </SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; &nbsp; 
&nbsp; &nbsp; </SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN 
style="COLOR: #800000">s:checkboxlist </SPAN><SPAN 
style="COLOR: #ff0000">name</SPAN><SPAN 
style="COLOR: #0000ff">="skills1"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label</SPAN><SPAN 
style="COLOR: #0000ff">="Skills 1"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list</SPAN><SPAN 
style="COLOR: #0000ff">="{ 'Java', '.Net', 'RoR', 'PHP' }"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value</SPAN><SPAN 
style="COLOR: #0000ff">="{ 'Java', '.Net' }"</SPAN><SPAN style="COLOR: #ff0000"> 
</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN 
style="COLOR: #000000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; </SPAN><SPAN 
style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">s:checkboxlist 
</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN 
style="COLOR: #0000ff">="skills2"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label</SPAN><SPAN 
style="COLOR: #0000ff">="Skills 2"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list</SPAN><SPAN 
style="COLOR: #0000ff">="#{ 1:'Java', 2: '.Net', 3: 'RoR', 4: 'PHP' 
}"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listKey</SPAN><SPAN 
style="COLOR: #0000ff">="key"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listValue</SPAN><SPAN 
style="COLOR: #0000ff">="value"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value</SPAN><SPAN 
style="COLOR: #0000ff">="{ 1, 2, 3 }"</SPAN><SPAN 
style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; 
&nbsp; </SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN 
style="COLOR: #800000">s:form</SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN 
style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">body</SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN 
style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">html</SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN></DIV><SPAN 
style="FONT-SIZE: smaller; FONT-STYLE: italic">清单1 
WebContent/checkboxlist.jsp</SPAN> 
<P>分布运行应用程序,在浏览器中键入:<A 
href="http://localhost:8080/Struts2_CoolTags/checkboxlist.jsp">http://localhost:8080/Struts2_CoolTags/checkboxlist.jsp</A>,出现如下图所示页面:</P>
<P><IMG alt=checkboxlist.jsp页面 
src="Strus 2的新表单标志的使用 - Max On Java - BlogJava.files/r_checkboxlist.gif"><BR><SPAN 
style="FONT-SIZE: smaller; FONT-STYLE: italic">清单2 checkboxlist.jsp页面</SPAN></P>
<H2>2、&lt;s:doubleselect /&gt;</H2>
<P>大家看Struts 2的showcase的例子,&lt;s:doubleselect /&gt;的用法如下所示:</P>
<DIV 
style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN 
style="COLOR: #000000">&nbsp; &nbsp; </SPAN><SPAN 
style="COLOR: #0000ff">&lt;</SPAN><SPAN 
style="COLOR: #800000">s:doubleselect<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; </SPAN><SPAN style="COLOR: #ff0000">tooltip</SPAN><SPAN 
style="COLOR: #0000ff">="Choose Your State"</SPAN><SPAN 
style="COLOR: #ff0000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
label</SPAN><SPAN style="COLOR: #0000ff">="State"</SPAN><SPAN 
style="COLOR: #ff0000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
name</SPAN><SPAN style="COLOR: #0000ff">="region"</SPAN><SPAN 
style="COLOR: #ff0000"> list</SPAN><SPAN style="COLOR: #0000ff">="{'North', 
'South'}"</SPAN><SPAN style="COLOR: #ff0000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; value</SPAN><SPAN style="COLOR: #0000ff">="'South'"</SPAN><SPAN 
style="COLOR: #ff0000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
doubleValue</SPAN><SPAN style="COLOR: #0000ff">="'Florida'"</SPAN><SPAN 
style="COLOR: #ff0000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
doubleList</SPAN><SPAN style="COLOR: #0000ff">="top == 'North' ? {'Oregon', 
'Washington'} : {'Texas', 'Florida'}"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
doubleName</SPAN><SPAN style="COLOR: #0000ff">="state"</SPAN><SPAN 
style="COLOR: #ff0000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
headerKey</SPAN><SPAN style="COLOR: #0000ff">="-1"</SPAN><SPAN 
style="COLOR: #ff0000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
headerValue</SPAN><SPAN style="COLOR: #0000ff">="---------- Please Select 
----------"</SPAN><SPAN style="COLOR: #ff0000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; emptyOption</SPAN><SPAN style="COLOR: #0000ff">="true"</SPAN><SPAN 
style="COLOR: #ff0000"> </SPAN><SPAN 
style="COLOR: #0000ff">/&gt;</SPAN></DIV><SPAN 
style="FONT-SIZE: smaller; FONT-STYLE: italic">清单3 Showcase中&lt;s:doubleselect 
/&gt;</SPAN> 
<P>很多朋友问:“上面的‘list’属性只有两个值,如果我有三个或更多的值,‘doublelist’属性应该如何设定呢?”</P>
<P>我建议的做法是先定义一个Map类型的对象,键为“list”的集合,值则为“doubleList”的集合,然后“doubleList”的OGNL写成“#myMap[top]”,如以下代码所示:</P>
<DIV 
style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ page language</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">java</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> contentType</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">text/html; 
charset=utf-8</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> pageEncoding</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">utf-8</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</SPAN><SPAN 
style="COLOR: #000000"><BR></SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ taglib prefix</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">s</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> uri</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">/struts-tags</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </SPAN><SPAN 
style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</SPAN><SPAN 
style="COLOR: #000000"><BR><BR></SPAN><SPAN 
style="COLOR: #0000ff">&lt;!</SPAN><SPAN style="COLOR: #ff00ff">DOCTYPE html 
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN 
style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">html </SPAN><SPAN 
style="COLOR: #ff0000">xmlns</SPAN><SPAN 
style="COLOR: #0000ff">="http://www.w3.org/1999/xhtml"</SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN 
style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">head</SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; &nbsp; 
</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN 
style="COLOR: #800000">title</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN 
style="COLOR: #000000">Struts 2 Cool Tags - </SPAN><SPAN 
style="COLOR: #ff0000">&amp;lt;</SPAN><SPAN 
style="COLOR: #000000">s:doubeselect/ </SPAN><SPAN 
style="COLOR: #ff0000">&amp;gt;</SPAN><SPAN 
style="COLOR: #0000ff">&lt;/</SPAN><SPAN 
style="COLOR: #800000">title</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN 
style="COLOR: #000000"><BR>&nbsp; &nbsp; </SPAN><SPAN 
style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">s:head 
</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN 
style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN 
style="COLOR: #800000">head</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN 
style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN 
style="COLOR: #800000">body</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN 
style="COLOR: #000000"> &nbsp; &nbsp;<BR>&nbsp; &nbsp; </SPAN><SPAN 
style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">h2</SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN 
style="COLOR: #ff0000">&amp;lt;</SPAN><SPAN 
style="COLOR: #000000">s:doubleselect/</SPAN><SPAN 
style="COLOR: #ff0000">&amp;gt;</SPAN><SPAN 
style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">h2</SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; &nbsp; 
</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN 
style="COLOR: #800000">s:form </SPAN><SPAN 
style="COLOR: #ff0000">action</SPAN><SPAN 
style="COLOR: #0000ff">="Store"</SPAN><SPAN style="COLOR: #ff0000"> </SPAN><SPAN 
style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; &nbsp; 
&nbsp; &nbsp; </SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN 
style="COLOR: #800000">s:set </SPAN><SPAN 
style="COLOR: #ff0000">name</SPAN><SPAN 
style="COLOR: #0000ff">="foobar"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp;value</SPAN><SPAN style="COLOR: #0000ff">="#{'Java': {'Spring', 
'Hibernate', 'Struts 2'}, '.Net': {'Linq', ' ASP.NET 2.0'}, 'Database': 
{'Oracle', 'SQL Server', 'DB2', 'MySQL'}}"</SPAN><SPAN style="COLOR: #ff0000"> 
</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN 
style="COLOR: #000000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; </SPAN><SPAN 
style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">s:doubleselect 
</SPAN><SPAN style="COLOR: #ff0000">list</SPAN><SPAN 
style="COLOR: #0000ff">="#foobar.keySet()"</SPAN><SPAN 
style="COLOR: #ff0000"><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doubleName</SPAN><SPAN 
style="COLOR: #0000ff">="technology"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doubleList</SPAN><SPAN 
style="COLOR: #0000ff">="#foobar[top]"</SPAN><SPAN 
style="COLOR: #ff0000">&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label</SPAN><SPAN 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -