﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-braint8-文章分类-初学Struts2</title><link>http://www.blogjava.net/braint8/category/41600.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 09 Dec 2009 00:44:48 GMT</lastBuildDate><pubDate>Wed, 09 Dec 2009 00:44:48 GMT</pubDate><ttl>60</ttl><item><title>Struts2---3</title><link>http://www.blogjava.net/braint8/articles/302440.html</link><dc:creator>情晚风</dc:creator><author>情晚风</author><pubDate>Sun, 15 Nov 2009 12:09:00 GMT</pubDate><guid>http://www.blogjava.net/braint8/articles/302440.html</guid><wfw:comment>http://www.blogjava.net/braint8/comments/302440.html</wfw:comment><comments>http://www.blogjava.net/braint8/articles/302440.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/braint8/comments/commentRss/302440.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/braint8/services/trackbacks/302440.html</trackback:ping><description><![CDATA[
		<link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" />
		<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:PunctuationKerning/>
  <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
  <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
  <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:Compatibility>
   <w:SpaceForUL/>
   <w:BalanceSingleByteDoubleByteWidth/>
   <w:DoNotLeaveBackslashAlone/>
   <w:ULTrailSpace/>
   <w:DoNotExpandShiftReturn/>
   <w:AdjustLineHeightInTable/>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
		<!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]-->
		<style>
				<!--
 /* Font Definitions */
 @font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-alt:SimSun;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	mso-pagination:none;
	font-size:10.5pt;
	mso-bidi-font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:宋体;
	mso-font-kerning:1.0pt;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
 /* Page Definitions */
 @page
	{mso-page-border-surround-header:no;
	mso-page-border-surround-footer:no;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:36.0pt;
	mso-footer-margin:36.0pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
		</style>
		<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:普通表格;
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
</style>
<![endif]-->
		<p class="MsoNormal">
				<span lang="EN-US">8</span>
				<span style="font-family: 宋体;">．</span>
				<span lang="EN-US">Struts2</span>
				<span style="font-family: 宋体;">获取</span>
				<span lang="EN-US">request,session,application</span>
				<span style="font-family: 宋体;">与前台交互</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">①<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">Map request =
(Map)ActionContext.<i>getContext</i>().get(</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"request"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">);</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">Map session =
(Map)ActionContext.<i>getContext</i>().getSession();</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">Map application = (Map)ActionContext.<i>getContext</i>().getApplication();<o:p></o:p></span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">②使用</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">IOC</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">依赖注入</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">基本只用到</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">session<o:p></o:p></span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">首先：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">Action implements
SessionAware<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">成员变量：</span>
				<b>
						<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">private</span>
				</b>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US"> Map&lt;String,
Object&gt; </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 192);" lang="EN-US">session</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">实现接口方法：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">   </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left; text-indent: 21pt;" align="left">
				<b>
						<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">public</span>
				</b>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
				</span>
				<b>
						<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">void</span>
				</b>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US"> setSession(Map&lt;String, Object&gt;
session) {</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 95);" lang="EN-US">// </span>
				<b>
						<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 159, 191);" lang="EN-US">TODO</span>
				</b>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 95);" lang="EN-US"> Auto-generated method stub</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">       </span>
				</span>
				<b>
						<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">this</span>
				</b>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">.</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 192);" lang="EN-US">session</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US"> = session;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">把获取的</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">session</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">交给</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">struts2</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">来创建</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">9</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">．分模块配置文件</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">Struts.xml</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">文件中使用</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">&lt;include file=”a.xml”/&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">xml</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">文件中配置各自模块的</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">action</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">信息，多人开发，</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">include</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">多个，避免版本冲突！</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">10</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">．</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">OGNL</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">表达式</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">①可针对对象来在</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">jsp</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">页面上调用对象的方法，比</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">el</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">表达式高级</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">(el</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">只能调对象的属性值如：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">user.username),ognl</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">可以使用</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">user.toString()<o:p></o:p></span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">②可访问当前</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">action</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">里的普通方法</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">,</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">如：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">UserAction</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">里方法</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">test();jsp</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">页面访问</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">&lt;s:property value=”test()” /&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">③可访问其他类的静态属性和方法：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">访问静态属性：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:property </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"@com.braint.struts2.util.TestUtil@STR"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">/&gt;&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">br</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">访问静态方法：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:property
</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"@com.braint.struts2.util.TestUtil@test()"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">/&gt;&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">br</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">静态方法的访问，</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">struts.xml</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">配置里需设置</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">constant </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">name</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"struts.ognl.allowStaticMethodAccess"
</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"true" </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">/&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">④可创建类的实例：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:property </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"@new <span style=""></span>com.braint.struts2.util.TestUtil()"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">/&gt;&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">br</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">⑤访问集合：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">结合访问对象与访问对象里的方法一样，可以通过访问</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">list,set</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">或</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">map</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">和获取集合里的值；</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">如：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">&lt;s:property value=”userList[0].name”
/&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">效果同上</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">&lt;s:property value=”userList.{name}[0]” /&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">单独</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">userList.{name}</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">效果是获取</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">userList</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">里的所有</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">name</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">属性的一个集合</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">&lt;s:property value=”userList.size()”
/&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">⑥更强大的过滤集合：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">&lt;s:property value=”userList.{?#this.name==’admin’}.name”
/&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">userList.{?#this.name==’admin’}</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">表示遍历</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">userList</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">，返回</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">name</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">值为</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">admin</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">的对象</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">userList.{^#this.name==’admin’}</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">过滤后返回的对象里的第一个</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">,^</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">表示开头</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">userList.{$#this.name==’admin’}</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">过滤后返回的对象里的最后一个</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">,$</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">表示结尾</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">&lt;s:property value=”userList[0].name
== null” /&gt;</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">空返回</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">flase;</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">非空</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">true<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">11</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">．</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">Struts2</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">标签</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
				</span>
		</p>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="ProgId" content="Word.Document" />
		<meta name="Generator" content="Microsoft Word 11" />
		<meta name="Originator" content="Microsoft Word 11" />
		<link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" />
		<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:PunctuationKerning/>
  <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
  <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
  <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:Compatibility>
   <w:SpaceForUL/>
   <w:BalanceSingleByteDoubleByteWidth/>
   <w:DoNotLeaveBackslashAlone/>
   <w:ULTrailSpace/>
   <w:DoNotExpandShiftReturn/>
   <w:AdjustLineHeightInTable/>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
		<!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]-->
		<style>
				<!--
 /* Font Definitions */
 @font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-alt:SimSun;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	mso-pagination:none;
	font-size:10.5pt;
	mso-bidi-font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:宋体;
	mso-font-kerning:1.0pt;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
 /* Page Definitions */
 @page
	{mso-page-border-surround-header:no;
	mso-page-border-surround-footer:no;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:36.0pt;
	mso-footer-margin:36.0pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
		</style>
		<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:普通表格;
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
</style>
<![endif]-->
		<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
				<a href="http://struts.apache.org/2.1.8/docs/tag-reference.html">http://struts.apache.org/2.1.8/docs/tag-reference.html</a>
		</span>
		<span style="font-size: 10pt; font-family: 宋体; color: black;">在线标签文档</span>
		<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
				<o:p>
				</o:p>
		</span>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">if,else if,else<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">iterator<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">list:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:iterator
</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"{1, 2, 3}" </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">var</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"test" </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:property </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"#test"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">/&gt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US"> |</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;/</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:iterator</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:iterator
</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"userList" </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">var</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"user" </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:property </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"#user.name"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">/&gt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US"> |</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;/</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:iterator</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">注意点：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">里取的</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">userList</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">必需在</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">action</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">里有成员变量且有</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">set,get</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">方法</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">Map:</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">与</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">list</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">类似</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left; text-indent: 21pt;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:iterator </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"#{1:’a’,
2:’b’, 3:’c’}" </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">var</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"test" </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:property </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">value</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"#test.key"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">/&gt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US"> #test.value<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;/</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">s:iterator</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">注意点：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">map</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">声明必须在</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">{}</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">前加</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">#</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">，与</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">list</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">的区别</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
<img src ="http://www.blogjava.net/braint8/aggbug/302440.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/braint8/" target="_blank">情晚风</a> 2009-11-15 20:09 <a href="http://www.blogjava.net/braint8/articles/302440.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2---2</title><link>http://www.blogjava.net/braint8/articles/Struts2.html</link><dc:creator>情晚风</dc:creator><author>情晚风</author><pubDate>Sun, 15 Nov 2009 12:08:00 GMT</pubDate><guid>http://www.blogjava.net/braint8/articles/Struts2.html</guid><wfw:comment>http://www.blogjava.net/braint8/comments/302439.html</wfw:comment><comments>http://www.blogjava.net/braint8/articles/Struts2.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/braint8/comments/commentRss/302439.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/braint8/services/trackbacks/302439.html</trackback:ping><description><![CDATA[
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="ProgId" content="Word.Document" />
		<meta name="Generator" content="Microsoft Word 11" />
		<meta name="Originator" content="Microsoft Word 11" />
		<link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" />
		<o:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="chsdate">
		</o:smarttagtype>
		<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:PunctuationKerning/>
  <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
  <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
  <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:Compatibility>
   <w:SpaceForUL/>
   <w:BalanceSingleByteDoubleByteWidth/>
   <w:DoNotLeaveBackslashAlone/>
   <w:ULTrailSpace/>
   <w:DoNotExpandShiftReturn/>
   <w:AdjustLineHeightInTable/>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
		<!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]-->
		<!--[if !mso]><object
 classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<![endif]-->
		<style>
				<!--
 /* Font Definitions */
 @font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-alt:SimSun;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	mso-pagination:none;
	font-size:10.5pt;
	mso-bidi-font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:宋体;
	mso-font-kerning:1.0pt;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
 /* Page Definitions */
 @page
	{mso-page-border-surround-header:no;
	mso-page-border-surround-footer:no;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:36.0pt;
	mso-footer-margin:36.0pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
		</style>
		<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:普通表格;
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
</style>
<![endif]-->
		<p class="MsoNormal">
				<span lang="EN-US">1</span>
				<span style="font-family: 宋体;">．根据示例来模仿运行</span>
		</p>
		<p class="MsoNormal" style="text-indent: 21pt;">
				<span style="font-family: 宋体;">①可解压</span>
				<span lang="EN-US">struts2-blank-<st1:chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on">2.1.8</st1:chsdate>.war</span>
				<span style="font-family: 宋体;">包</span>
				<span lang="EN-US">,</span>
				<span style="font-family: 宋体;">取</span>
				<span lang="EN-US">struts2-blank-2.1.8\WEB-INF\classes\</span>
				<span style="font-family: 宋体;">目录下的</span>
				<span lang="EN-US">struts.xml</span>
				<span style="font-family: 宋体;">文件至自己工程</span>
				<span lang="EN-US">src</span>
				<span style="font-family: 宋体;">目录下</span>
		</p>
		<p class="MsoNormal" style="text-indent: 21pt;">
				<span style="font-family: 宋体;">②复制</span>
				<span lang="EN-US">struts2-blank-<st1:chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on">2.1.8</st1:chsdate>\WEB-INF\lib\</span>
				<span style="font-family: 宋体;">目录下包至工程</span>
				<span lang="EN-US">lib</span>
				<span style="font-family: 宋体;">下</span>
		</p>
		<p class="MsoNormal" style="text-indent: 21pt;">
				<span style="font-family: 宋体;">③配置</span>
				<span lang="EN-US">web.xml</span>
				<span style="font-family: 宋体;">文件，主要是</span>
				<span lang="EN-US">filter</span>
				<span style="font-family: 宋体;">的配置</span>
		</p>
		<p class="MsoNormal" style="text-indent: 21pt;">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">2</span>
				<span style="font-family: 宋体;">．</span>
				<span lang="EN-US">Struts.xml</span>
				<span style="font-family: 宋体;">里的</span>
				<span lang="EN-US">namaspace=”/”</span>
				<span style="font-family: 宋体;">这里就是地址访问路径</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">
						<span style=""> </span>&lt;action name=”hello”&gt;</span>
				<span style="font-family: 宋体;">可以当成路径</span>
				<span lang="EN-US">/hello.action</span>
				<span style="font-family: 宋体;">访问，</span>
				<span lang="EN-US">action</span>
				<span style="font-family: 宋体;">可以省略，与</span>
				<span lang="EN-US">struts1</span>
				<span style="font-family: 宋体;">中</span>
				<span lang="EN-US">.do</span>
				<span style="font-family: 宋体;">一样</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">3</span>
				<span style="font-family: 宋体;">．</span>
				<span lang="EN-US">Struts2</span>
				<span style="font-family: 宋体;">可以配置修改配置不用重启</span>
				<span lang="EN-US">&lt;constant name="struts.devMode" value="true"
/&gt;</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">对于</span>
				<span lang="EN-US">strtus2</span>
				<span style="font-family: 宋体;">属性的设置即</span>
				<span lang="EN-US">&lt;constant name=”” value=””/&gt;</span>
				<span style="font-family: 宋体;">的</span>
				<span lang="EN-US">name</span>
				<span style="font-family: 宋体;">位置位于</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">Struts2-core-<st1:chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on">2.1.8</st1:chsdate>.jar\org.apache.struts2\static\default.properties</span>
				<span style="font-family: 宋体;">文件下</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">执行过程：</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-family: 宋体;">如地址：</span>
				<span lang="EN-US">http://localhost:8888/Struts2_01/hello11</span>
				<span style="font-family: 宋体;">提交</span>
				<span lang="EN-US">tomcat</span>
				<span style="font-family: 宋体;">后，获取工程名对应发布的工程</span>
				<span lang="EN-US">Struts2_01</span>
				<span style="font-family: 宋体;">，然后寻找对应工程的</span>
				<span lang="EN-US">web.xml</span>
				<span style="font-family: 宋体;">文件，寻找对应的</span>
				<span lang="EN-US">namespace(</span>
				<span style="font-family: 宋体;">为该工程后的路径，如</span>
				<span lang="EN-US">namespace=”/test”</span>
				<span style="font-family: 宋体;">则地址为</span>
				<span lang="EN-US">
						<a href="http://localhost:8888/Struts2_01/test/hello11%29,%E7%84%B6%E5%90%8E%E5%86%8D%E6%A0%B9%E6%8D%AEhello11">http://localhost:8888/Struts2_01/test/hello11),<span style="font-family: 宋体;" lang="EN-US"><span lang="EN-US">然后再根据</span></span>hello11</a>
				</span>
				<span style="font-family: 宋体;">寻找对应的</span>
				<span lang="EN-US">action,</span>
				<span style="font-family: 宋体;">找到后，通过</span>
				<span lang="EN-US">result</span>
				<span style="font-family: 宋体;">返回配置的</span>
				<span lang="EN-US">jsp</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="">
				<span lang="EN-US">4</span>
				<span style="font-family: 宋体;">．</span>
				<span lang="EN-US">Struts.xml</span>
				<span style="font-family: 宋体;">文件的标签提示问题</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">
						<span style="">       </span>Window-preferences-</span>
				<span style="font-family: 宋体;">搜索</span>
				<span lang="EN-US">catalog—add</span>
		</p>
		<p class="MsoNormal" style="margin-left: 21pt;">
				<span lang="EN-US">Location:</span>
		</p>
		<p class="MsoNormal" style="margin-left: 21pt;">
				<span lang="EN-US">Key Type:URI</span>
		</p>
		<p class="MsoNormal" style="margin-left: 21pt;">
				<span lang="EN-US">Key: <a href="http://struts.apache.org/dtds/struts-2.0.dtd">http://struts.apache.org/dtds/struts-2.0.dtd</a></span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">最好修改</span>
				<span lang="EN-US">myeclipse</span>
				<span style="font-family: 宋体;">的快捷键设置</span>
				<span lang="EN-US">,window-preferences-General-keys,Context
Assist</span>
				<span style="font-family: 宋体;">设置为</span>
				<span lang="EN-US">alt+/</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">5</span>
				<span style="font-family: 宋体;">．</span>
				<span lang="EN-US">Result</span>
				<span style="font-family: 宋体;">里的</span>
				<span lang="EN-US">name</span>
				<span style="font-family: 宋体;">配置了</span>
				<span lang="EN-US">action</span>
				<span style="font-family: 宋体;">里调用方法后的返回</span>
				<span lang="EN-US">string</span>
				<span style="font-family: 宋体;">所匹配的字符串，根据这个匹配的字符串查找配置里的跳转的页面；默认不配置则为</span>
				<span lang="EN-US">success</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="">
				<span lang="EN-US">6</span>
				<span style="font-family: 宋体;">．</span>
				<span lang="EN-US">Action</span>
				<span style="font-family: 宋体;">接收参数方式</span>
		</p>
		<p class="MsoNormal" style="">
				<span style="font-family: 宋体;">①</span>
				<span lang="EN-US">Action</span>
				<span style="font-family: 宋体;">类里写属性</span>
				<span lang="EN-US">,</span>
				<span style="font-family: 宋体;">并有</span>
				<span lang="EN-US">set,get</span>
				<span style="font-family: 宋体;">方法</span>
				<span lang="EN-US">,</span>
				<span style="font-family: 宋体;">地址传递参数会自动赋值</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">地址：</span>
				<span lang="EN-US">http://localhost:8080/user!add?name=a&amp;age=8</span>
				<span style="font-family: 宋体;">　</span>
				<span lang="EN-US">-----</span>
				<span style="font-family: 宋体;">成员</span>
				<span lang="EN-US">String name; int age;</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">调用</span>
				<span lang="EN-US">user.action</span>
				<span style="font-family: 宋体;">里的</span>
				<span lang="EN-US">add</span>
				<span style="font-family: 宋体;">方法</span>
				<span lang="EN-US">,</span>
				<span style="font-family: 宋体;">且通过参数</span>
				<span lang="EN-US">name</span>
				<span style="font-family: 宋体;">，获取值后调用</span>
				<span lang="EN-US">setName();</span>
				<span style="font-family: 宋体;">提交</span>
				<span lang="EN-US">action</span>
				<span style="font-family: 宋体;">时自动赋值</span>
		</p>
		<p class="MsoNormal" style="">
				<span style="font-family: 宋体;">②</span>
				<span lang="EN-US">action</span>
				<span style="font-family: 宋体;">可以接收模型对象</span>
				<span lang="EN-US">,set,get</span>
				<span style="font-family: 宋体;">方法</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">地址：</span>
				<span lang="EN-US">http://localhost:8080/user!add?user.name=a&amp;user.age=8</span>
		</p>
		<p class="MsoNormal" style="">
				<span lang="EN-US">Action</span>
				<span style="font-family: 宋体;">里拥有成员</span>
				<span lang="EN-US">User user;</span>
				<span style="font-family: 宋体;">且</span>
				<span lang="EN-US">User</span>
				<span style="font-family: 宋体;">类里拥有成员变量</span>
				<span lang="EN-US">name,age</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">自动把参数上的</span>
				<span lang="EN-US">user.name</span>
				<span style="font-family: 宋体;">和</span>
				<span lang="EN-US">user.age</span>
				<span style="font-family: 宋体;">值赋给</span>
				<span lang="EN-US">user</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">请求地址传输参数的赋值都交给模型来处理．</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">7</span>
				<span style="font-family: 宋体;">．简单数据验证</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">String name;</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">Action</span>
				<span style="font-family: 宋体;">验证后，对于</span>
				<span lang="EN-US">name</span>
				<span style="font-family: 宋体;">验证不通过，使用</span>
				<span lang="EN-US">this.addFieldError(“name”,”</span>
				<span style="font-family: 宋体;">错误提示信息！</span>
				<span lang="EN-US">”);</span>
		</p>
		<p class="MsoNormal" style="">
				<span lang="EN-US">Jsp</span>
				<span style="font-family: 宋体;">页面则使用</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">①</span>
				<span lang="EN-US">&lt;s:fielderror
fieldname=”name”/&gt;</span>
				<span style="font-family: 宋体;">固定样式，添加了</span>
				<span lang="EN-US">ul,li</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">②</span>
				<span lang="EN-US">&lt;s:property<span style="">  </span>value=”errors.name[0]”/&gt;</span>
				<span style="font-family: 宋体; color: red;">常用</span>
				<span lang="EN-US">;</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">原理：错误信息存放在</span>
				<span lang="EN-US">errors</span>
				<span style="font-family: 宋体;">里</span>
				<span lang="EN-US">;</span>
		</p>
		<p class="MsoNormal" style="text-indent: 31.5pt;">
				<span lang="EN-US">errors</span>
				<span style="font-family: 宋体;">为字符串</span>
				<span lang="EN-US">map</span>
				<span style="font-family: 宋体;">，形式如：</span>
				<span lang="EN-US">errors={name=[</span>
				<span style="font-family: 宋体;">错误提示信息！</span>
				<span lang="EN-US">]},</span>
				<span style="font-family: 宋体;">而</span>
				<span lang="EN-US">map</span>
				<span style="font-family: 宋体;">里的</span>
				<span lang="EN-US">value</span>
				<span style="font-family: 宋体;">是</span>
				<span lang="EN-US">name</span>
				<span style="font-family: 宋体;">其实是个字符串数组或集合</span>
				<span lang="EN-US">[,,,];</span>
		</p>
		<p class="MsoNormal">
				<span style="font-family: 宋体;">流程：</span>
				<span lang="EN-US">jsp</span>
				<span style="font-family: 宋体;">页面调用</span>
				<span lang="EN-US">action</span>
				<span style="font-family: 宋体;">，</span>
				<span lang="EN-US">action</span>
				<span style="font-family: 宋体;">处理逻辑，</span>
				<span lang="EN-US">return</span>
				<span style="font-family: 宋体;">后，</span>
				<span lang="EN-US">action</span>
				<span style="font-family: 宋体;">里的所有成员变量都已经存在</span>
				<span lang="EN-US">value stack</span>
				<span style="font-family: 宋体;">里，就跟</span>
				<span lang="EN-US">struts1</span>
				<span style="font-family: 宋体;">里的</span>
				<span lang="EN-US">form</span>
				<span style="font-family: 宋体;">类似已经存在</span>
				<span lang="EN-US">request</span>
				<span style="font-family: 宋体;">中，可以直接在页面上取值</span>
				<span lang="EN-US">,</span>
				<span style="font-family: 宋体;">只不过</span>
				<span lang="EN-US">struts2</span>
				<span style="font-family: 宋体;">里存在</span>
				<span lang="EN-US">value stack</span>
				<span style="font-family: 宋体;">里；通过</span>
				<span lang="EN-US">return</span>
				<span style="font-family: 宋体;">的字符串找到相应的</span>
				<span lang="EN-US">result</span>
				<span style="font-family: 宋体;">的</span>
				<span lang="EN-US">name</span>
				<span style="font-family: 宋体;">值跳转到对应的</span>
				<span lang="EN-US">jsp</span>
				<span style="font-family: 宋体;">页面</span>
				<span lang="EN-US">,jsp</span>
				<span style="font-family: 宋体;">页面可以通过类似</span>
				<span lang="EN-US">EL</span>
				<span style="font-family: 宋体;">表达式取值，也可以通过</span>
				<span lang="EN-US">&lt;s:property&gt;</span>
				<span style="font-family: 宋体;">取值。</span>
		</p>
<img src ="http://www.blogjava.net/braint8/aggbug/302439.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/braint8/" target="_blank">情晚风</a> 2009-11-15 20:08 <a href="http://www.blogjava.net/braint8/articles/Struts2.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>初学struts2(一)</title><link>http://www.blogjava.net/braint8/articles/294226.html</link><dc:creator>情晚风</dc:creator><author>情晚风</author><pubDate>Mon, 07 Sep 2009 14:18:00 GMT</pubDate><guid>http://www.blogjava.net/braint8/articles/294226.html</guid><wfw:comment>http://www.blogjava.net/braint8/comments/294226.html</wfw:comment><comments>http://www.blogjava.net/braint8/articles/294226.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/braint8/comments/commentRss/294226.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/braint8/services/trackbacks/294226.html</trackback:ping><description><![CDATA[初学struts2(一)<br />1.在WEB工程中添加jar包(版本struts-2.1.6)<br />commons-logging-1.0.4.jar<br />freemarker-2.3.13.jar<br />ognl-2.6.11.jar<br />struts2-core-2.1.6.jar<br />xwork-2.1.2.jar<br /><br />2.编写Action类和JSP页面<br />如：LoginAction.java 部分代码<br />        private String usernmae;<br />        private String password;<br />        (set,get方法)<br />        <br />        public String execute(){<br />            return "success";<br />        }<br />JSP:<br />&lt;form action="login.action" method="post" &gt;<br /><br />&lt;/form&gt;<br />使用login.action<br /><br />3.配置web.xml<br />    &lt;filter&gt;<br />        &lt;filter-name&gt;struts2&lt;/filter-name&gt;<br />        &lt;filter-class&gt;<br />            org.apache.struts2.dispatcher.FilterDispatcher<br />        &lt;/filter-class&gt;<br />    &lt;/filter&gt;<br /><br />    &lt;filter-mapping&gt;<br />        &lt;filter-name&gt;struts2&lt;/filter-name&gt;<br />        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br />    &lt;/filter-mapping&gt;<br />###:<br /><font color="#ff0000">这个没配置的话，无法找到JSP页面提交的action,404错误(暂时不知道为什么。。。)<br />struts1里是使用&lt;servlet&gt;&lt;/servlet&gt;来配置寻找struts-config.xml文件,再在struts-config.xml文件中寻找相应的action<br />struts2里则使用&lt;filter&gt;&lt;/filter&gt;,这里叫"拦截器"!</font><br />    <br />4.配置struts.xml(必须放在src目录下)<br />&lt;?xml version="1.0" encoding="UTF-8" ?&gt;<br /><br />&lt;!DOCTYPE struts PUBLIC<br />    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"<br />    "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;<br /><br />&lt;!-- START SNIPPET: xworkSample --&gt;<br />&lt;struts&gt;<br /><br />    &lt;package name="struts2" extends="struts-default"&gt;<br />        &lt;action name="login" class="com.test.action.LoginAction"&gt;<br />            &lt;result&gt;/result.jsp&lt;/result&gt;<br />        &lt;/action&gt;<br />    &lt;/package&gt;<br />    <br />&lt;/struts&gt;<br /><br />&lt;!-- END SNIPPET: xworkSample --&gt;<br /><br />###：<br /><font color="#ff0000">这里的&lt;result name="success"&gt;/result.jsp&lt;/result&gt;根据LoginAction里的execute方法的返回值来自动寻找的，<br />如果不配置，默认为"success"!这里和struts1是一样的，默认配置都是跳转也就是转发。</font><br /><br /><br />出错：<br />Unable to load configuration. - bean - jar:file:/D:/Struts2/workspace/struts2/WebRoot/WEB-INF/lib/struts2-core-2.1.6.jar!/struts-default.xml:46:178<br />加载不了jar包？按提示应该是加载不了struts2-core-2.1.6.jar!/struts-default.xml，所以就无法读取JSP提交对应的action<br />难道高版本的有问题，因为自己看的资料是2.0.14版本...还是上网查资料!<br /><br />解决方法：<br />在原来加载五个包的基础上，在Struts2的解压缩文件夹内的lib文件夹里， 我们找到下列2个jar : commons-fileupload-1.2.1.jar、commons-io-1.3.2.jar，把他们加载。 <br /><br /><br /><br /><br /><img src ="http://www.blogjava.net/braint8/aggbug/294226.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/braint8/" target="_blank">情晚风</a> 2009-09-07 22:18 <a href="http://www.blogjava.net/braint8/articles/294226.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>