﻿<?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>C++博客-fenglin-文章分类-Struts2</title><link>http://www.cppblog.com/fenglin/category/15113.html</link><description>创新、创意、挑战</description><language>zh-cn</language><lastBuildDate>Mon, 04 Jul 2011 20:14:30 GMT</lastBuildDate><pubDate>Mon, 04 Jul 2011 20:14:30 GMT</pubDate><ttl>60</ttl><item><title>SSH&amp;MySQL数据存取乱码</title><link>http://www.cppblog.com/fenglin/articles/134031.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Thu, 18 Nov 2010 14:39:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/134031.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/134031.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/134031.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/134031.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/134031.html</trackback:ping><description><![CDATA[使用Hibernate向MySQL数据库里写了数据，全是乱码：<br><br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">mysql</span><span style="COLOR: #808080">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">select</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">*</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">from</span><span style="COLOR: #000000">&nbsp;tbl_Category;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">+</span><span style="COLOR: #008080">--</span><span style="COLOR: #008080">--+--------------------+--------------------+----------+</span><span style="COLOR: #008080"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;id&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;descr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;parentId&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">+</span><span style="COLOR: #008080">--</span><span style="COLOR: #008080">--+--------------------+--------------------+----------+</span><span style="COLOR: #008080"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;</span><span style="COLOR: #800000; FONT-WEIGHT: bold">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;��?????�????&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;��?????�????&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">NULL</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;</span><span style="COLOR: #800000; FONT-WEIGHT: bold">2</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;????��??????&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;????��??????&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">NULL</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;</span><span style="COLOR: #800000; FONT-WEIGHT: bold">3</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;??�?�???????&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;??�?�???????&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">NULL</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;</span><span style="COLOR: #800000; FONT-WEIGHT: bold">4</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;???????�????&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;???????�????&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">NULL</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;</span><span style="COLOR: #800000; FONT-WEIGHT: bold">5</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;?����?�??�??&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;?����?�??�??&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">NULL</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;</span><span style="COLOR: #800000; FONT-WEIGHT: bold">6</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;?�???????�?�??????&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;?�???????�?�??????&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">NULL</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">+</span><span style="COLOR: #008080">--</span><span style="COLOR: #008080">--+--------------------+--------------------+----------+</span><span style="COLOR: #008080"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #800000; FONT-WEIGHT: bold">6</span><span style="COLOR: #000000">&nbsp;rows&nbsp;</span><span style="COLOR: #808080">in</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">set</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #800000; FONT-WEIGHT: bold">0.10</span><span style="COLOR: #000000">&nbsp;sec)</span></div>
<br>为了能处理Unicode编码，最好将数据库库的编码设置为UTF8(这样就可以不管是哪国文字都能正常显示)，连接时也用UTF8来处理。我们先查看当前数据的编码设置情况：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">mysql</span><span style="COLOR: #808080">&gt;</span><span style="COLOR: #000000">&nbsp;show&nbsp;variables&nbsp;</span><span style="COLOR: #808080">like</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #ff0000">'</span><span style="COLOR: #ff0000">character_set_%</span><span style="COLOR: #ff0000">'</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">+</span><span style="COLOR: #008080">--</span><span style="COLOR: #008080">------------------------+----------------------------+</span><span style="COLOR: #008080"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;Variable_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">+</span><span style="COLOR: #008080">--</span><span style="COLOR: #008080">------------------------+----------------------------+</span><span style="COLOR: #008080"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;latin1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_connection&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;latin1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_database&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;utf8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_filesystem&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000; FONT-WEIGHT: bold">binary</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_results&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;latin1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;latin1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_system&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;utf8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_sets_dir&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">usr</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">share</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">mysql</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">charsets</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">+</span><span style="COLOR: #008080">--</span><span style="COLOR: #008080">------------------------+----------------------------+</span><span style="COLOR: #008080"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #800000; FONT-WEIGHT: bold">8</span><span style="COLOR: #000000">&nbsp;rows&nbsp;</span><span style="COLOR: #808080">in</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">set</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #800000; FONT-WEIGHT: bold">0.00</span><span style="COLOR: #000000">&nbsp;sec)</span></div>
以上是未设置前的编码情况，通过以下命令来设置编码：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">mysql</span><span style="COLOR: #808080">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">set</span><span style="COLOR: #000000">&nbsp;character_set_client</span><span style="COLOR: #808080">=</span><span style="COLOR: #000000">utf8;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">Query&nbsp;OK,&nbsp;</span><span style="COLOR: #800000; FONT-WEIGHT: bold">0</span><span style="COLOR: #000000">&nbsp;rows&nbsp;affected&nbsp;(</span><span style="COLOR: #800000; FONT-WEIGHT: bold">0.00</span><span style="COLOR: #000000">&nbsp;sec)</span></div>
使用set命令将相应的参数设置相应的值，请自己一个一个设置，下面是设置好了的。<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">mysql</span><span style="COLOR: #808080">&gt;</span><span style="COLOR: #000000">&nbsp;show&nbsp;variables&nbsp;</span><span style="COLOR: #808080">like</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #ff0000">'</span><span style="COLOR: #ff0000">character_set_%</span><span style="COLOR: #ff0000">'</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">+</span><span style="COLOR: #008080">--</span><span style="COLOR: #008080">------------------------+----------------------------+</span><span style="COLOR: #008080"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;Variable_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">+</span><span style="COLOR: #008080">--</span><span style="COLOR: #008080">------------------------+----------------------------+</span><span style="COLOR: #008080"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;utf8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_connection&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;utf8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_database&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;utf8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_filesystem&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000; FONT-WEIGHT: bold">binary</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_results&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;utf8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;utf8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_set_system&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;utf8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;character_sets_dir&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">usr</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">share</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">mysql</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">charsets</span><span style="COLOR: #808080">/</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #808080">|</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #808080">+</span><span style="COLOR: #008080">--</span><span style="COLOR: #008080">------------------------+----------------------------+</span><span style="COLOR: #008080"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #800000; FONT-WEIGHT: bold">8</span><span style="COLOR: #000000">&nbsp;rows&nbsp;</span><span style="COLOR: #808080">in</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">set</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #800000; FONT-WEIGHT: bold">0.00</span><span style="COLOR: #000000">&nbsp;sec)</span></div>
到此为止，MySQL数据库编码被我们设置好了。<br>在连接MySQL数据库时，使用如下连接串：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">jdbc.url=jdbc:mysql://192.168.1.114:3306/szblcz?useUnicode=true</span><span style="COLOR: #ff0000">&amp;characterEncoding</span><span style="COLOR: #000000">=UTF-8</span></div>
我这里是配置在一个Properties文件里。<span style="COLOR: red; FONT-SIZE: 14pt">useUnicode=true&amp;characterEncoding=UTF-8 这两个参数起到了至关重要的作用。</span><br>到这里一切再测试一下，应该没问题了。
<img src ="http://www.cppblog.com/fenglin/aggbug/134031.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-11-18 22:39 <a href="http://www.cppblog.com/fenglin/articles/134031.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring3.0.4&amp;Struts2.2.1&amp;Hibernate3.5.6整合过程总结</title><link>http://www.cppblog.com/fenglin/articles/131239.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Mon, 25 Oct 2010 14:14:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/131239.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/131239.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/131239.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/131239.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/131239.html</trackback:ping><description><![CDATA[&nbsp;
<p><span><span>1.<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span>新建一个</span><span>Dynamic Web project</span><span>工程。</span></p>
<p><span><span>2.<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span>将</span><span>Hibernate</span><span>的</span><span>JAR</span><span>包复制到</span><span>/ SSH</span><span>工程</span><span>/WebContent/WEB-INF/lib</span><span>文件夹里，将</span><span>hibernate.cfg.xml</span><span>文件复制到</span><span>/SSH</span><span>工程</span><span>/src</span><span>文件夹里，配置好数据库连接参数。建立一个实体类（无论使用</span><span>XML</span><span>配置方式还是</span><span>Annotation</span><span>的注解方式），测试其是否能正常工作。正常工作后再进行下一步。</span></p>
<p><span><span>3.<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span>将</span><span>Struts2</span><span>的</span><span>JAR</span><span>包复制到</span><span>/ SSH</span><span>工程</span><span>/WebContent/WEB-INF/lib</span><span>文件夹里，将</span><span>struts.xml</span><span>复制到</span><span>/SSH</span><span>工程</span><span>/src</span><span>文件夹里，再将</span><span>web.xml</span><span>复制到</span><span>/SSH</span><span>工程</span><span>/WebContent/WEB-INF</span><span>文件夹里，新建一个</span><span>Action</span><span>测试其是否能正常工作。</span></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span>&lt;</span><span>action</span><span> <span>name</span><span>=</span><em><span>"index"</span></em><span>&gt;</span></span></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span>&lt;</span><span>result</span><span>&gt;</span><span>/index.jsp</span><span>&lt;/</span><span>result</span><span>&gt;</span></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span>&lt;/</span><span>action</span><span>&gt;</span></p>
<p><span><span>4.<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span>将</span><span>Struts</span><span>插件</span><span>JAR</span><span>复制到</span><span>/ SSH</span><span>工程</span><span>/WebContent/WEB-INF/lib</span><span>文件夹里，将</span><span>Spring</span><span>的</span><span>JAR</span><span>包复制到</span><span>/ SSH</span><span>工程</span><span>/WebContent/WEB-INF/lib</span><span>文件夹里，将</span><span>beans.xml</span><span>复制到</span><span>/SSH</span><span>工程</span><span>/src</span><span>文件夹里，将</span><span>Hibernate</span><span>配置信息在</span><span>beans.xml</span><span>里配置好，就可以将</span><span>Hibernate</span><span>的配置文件</span><span>hibernate.cfg.xml</span><span>删除，集成测试是否能正常工作。</span></p>
<p><span><span>5.<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span>最后的文件结构如下图所示</span></p>
<p>&#160;</p>
<img border=0 alt="" src="http://www.cppblog.com/images/cppblog_com/fenglin/filesystem.jpg" width=302 height=468>
<img src ="http://www.cppblog.com/fenglin/aggbug/131239.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-25 22:14 <a href="http://www.cppblog.com/fenglin/articles/131239.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SSH_乱码问题解决办法</title><link>http://www.cppblog.com/fenglin/articles/130966.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 23 Oct 2010 02:53:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/130966.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/130966.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/130966.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/130966.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/130966.html</trackback:ping><description><![CDATA[<strong>方法一，手动转换编码。</strong><br /><span style="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span"><span style="text-align: left; line-height: 23px; font-family: simsun; font-size: 14px" class="Apple-style-span">如：outStr &nbsp; = &nbsp; new &nbsp; String(inStr.getBytes( "iso8859-1 "));<span class="Apple-converted-space">&nbsp;<br /><br /></span></span></span><strong>方法二，添加一个filter，代码如下：</strong><br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" /><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">filter</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">filter-name</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">encodingFilter</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter-name</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">filter-class</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">org.springframework.web.filter.CharacterEncodingFilter</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter-class</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">init-param</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">param-name</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">encoding</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">param-name</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">param-value</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">GBK</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">param-value</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">init-param</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">filter-mapping</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">filter-name</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">encodingFilter</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter-name</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">url-pattern</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">/*</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">url-pattern</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" />&nbsp;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter-mapping</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" /></span></div><br /><strong>方法三，设置Struts2的I18N常量（默认值为UTF-8）：</strong><br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><img align="top" src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"  alt="" /><span style="color: #0000ff">&lt;</span><span style="color: #800000">constant&nbsp;</span><span style="color: #ff0000">name</span><span style="color: #0000ff">="struts.i18n.encoding"</span><span style="color: #ff0000">&nbsp;value</span><span style="color: #0000ff">="UTF-8"</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">constant</span><span style="color: #0000ff">&gt;</span></div><font face="宋体"><br /><strong style="color: red">注：前端编码格式与后台编码格式一样才能正常，如果不一样，就转成与前端一样的格式。因此，这里的编码格式应该为你实际的编码格式名称。</strong></font><img src ="http://www.cppblog.com/fenglin/aggbug/130966.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-23 10:53 <a href="http://www.cppblog.com/fenglin/articles/130966.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_openSessionInView的相关问题</title><link>http://www.cppblog.com/fenglin/articles/130965.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 23 Oct 2010 02:51:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/130965.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/130965.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/130965.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/130965.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/130965.html</trackback:ping><description><![CDATA[<p>如果在Spring（beans.xml）里没有配置事务，在web.xml配置了openSessionInView，然后调用了save方法，openSessionInView认为这个方法为只读。</p>
<p>如果配置文件（beans.xml）里没有配置事务边界，openSessionInView拦截到的任何方法的Session都认为是只读的。<br><br>openSessionInViewFilter<br></p>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">OpenSessionInView</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">OpenSessionInView</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/*</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;</span></div>
<p>注意加在struts2 filter之前。<br><br><br><strong style="COLOR: red">解决方法：配置事务<br></p>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">bean&nbsp;</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="transactionManager"</span><span style="COLOR: #ff0000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;class</span><span style="COLOR: #0000ff">="org.springframework.orm.hibernate3.HibernateTransactionManager"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">property&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="sessionFactory"</span><span style="COLOR: #ff0000">&nbsp;ref</span><span style="COLOR: #0000ff">="sessionFactory"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">bean</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">aop:config</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">aop:pointcut&nbsp;</span><span style="COLOR: #ff0000">expression</span><span style="COLOR: #0000ff">="execution(public&nbsp;*&nbsp;com.bebig.userregister.service..*.*(..))"</span><span style="COLOR: #ff0000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id</span><span style="COLOR: #0000ff">="servicePointcut"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">aop:advisor&nbsp;</span><span style="COLOR: #ff0000">advice-ref</span><span style="COLOR: #0000ff">="txAdvisor"</span><span style="COLOR: #ff0000">&nbsp;pointcut-ref</span><span style="COLOR: #0000ff">="servicePointcut"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">aop:config</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tx:advice&nbsp;</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="txAdvisor"</span><span style="COLOR: #ff0000">&nbsp;transaction-manager</span><span style="COLOR: #0000ff">="transactionManager"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tx:attributes</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tx:method&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="exists"</span><span style="COLOR: #ff0000">&nbsp;read-only</span><span style="COLOR: #0000ff">="true"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tx:method&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="add*"</span><span style="COLOR: #ff0000">&nbsp;propagation</span><span style="COLOR: #0000ff">="REQUIRED"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tx:attributes</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tx:advice</span><span style="COLOR: #0000ff">&gt;</span></div>
</strong>
<img src ="http://www.cppblog.com/fenglin/aggbug/130965.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-23 10:51 <a href="http://www.cppblog.com/fenglin/articles/130965.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SSH_could not initialize proxy - no Session</title><link>http://www.cppblog.com/fenglin/articles/130933.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Fri, 22 Oct 2010 15:02:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/130933.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/130933.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/130933.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/130933.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/130933.html</trackback:ping><description><![CDATA[<p>报这个错误信息：<br>could not initialize proxy - no Session<br>原因：由于在加载数据时使用了load方法，返回的是一个代理对象，而在真正要使用数据时，Session已经被关闭，因此就会报此错误信息。<br>解决办法：<br>将Session的生命周期延长到JSP展现层，通过配置web.xml来完成。<br></p>
<span id=Codehighlighter1_246_281_Open_Text>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">OpenSessionInView</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">OpenSessionInView</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/*</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">&gt;</span></div>
</span><br>将以上Filter加到web.xml文件里合适位置，注意Filter配置存在先后顺序。<br>
<img src ="http://www.cppblog.com/fenglin/aggbug/130933.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-22 23:02 <a href="http://www.cppblog.com/fenglin/articles/130933.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_总结</title><link>http://www.cppblog.com/fenglin/articles/129893.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Thu, 14 Oct 2010 09:39:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129893.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129893.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129893.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129893.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129893.html</trackback:ping><description><![CDATA[<p align=left>1、Action<br>&nbsp;&nbsp;&nbsp;a)namespace（掌握）<br>&nbsp;&nbsp;&nbsp;b)path（掌握）<br>&nbsp;&nbsp;&nbsp;c)DMI（掌握）<br>&nbsp;&nbsp;&nbsp;d)Wildcard（掌握）<br>&nbsp;&nbsp;&nbsp;e)接收参数（掌握前两种）<br>&nbsp;&nbsp;&nbsp;f)访问request等（掌握Map IOC方式）<br>&nbsp; g)简单数据验证（掌握addFieldError和&lt;s:fieldError&gt;）<br>2、Result<br>&nbsp;&nbsp;&nbsp;a)结果类型（掌握四种，重点两种）<br>&nbsp;&nbsp;&nbsp;b)全局结果（掌握）<br>&nbsp;&nbsp;&nbsp;c)动态结果（了解）<br>3、OGNL表达式（精通）<br>&nbsp;&nbsp;&nbsp;a)#%$<br>4、声明式异常处理（了解）<br>5、I18N（了解）<br>6、CRUD的过程（最重要是设计与规划）（精通）<br>7、Interceptor的原理（掌握）<br><img border=0 alt="" src="http://www.cppblog.com/images/cppblog_com/fenglin/overview.png" width=501 height=337><br><strong>图一</strong><br><img border=0 alt="" src="http://www.cppblog.com/images/cppblog_com/fenglin/Struts2-Architecture.png" width=640 height=750><br><strong>图二</strong><br><br>8、类型转换（掌握默认，了解自定义）<br>9、常用标签（掌握）</p>
<img src ="http://www.cppblog.com/fenglin/aggbug/129893.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-14 17:39 <a href="http://www.cppblog.com/fenglin/articles/129893.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_类型转换器（Type Conversion）</title><link>http://www.cppblog.com/fenglin/articles/129833.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Thu, 14 Oct 2010 04:40:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129833.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129833.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129833.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129833.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129833.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 常用了类型转换器有两种，一种是作用于Action的，另一种是作用于整个Application的，下面分别介绍。1、作用于Action的转换器TestAction.javapackage&nbsp;com.bebig.action;import&nbsp;java.awt.Point;import&nbsp;java.util.List;import&nbsp;java.util.Map;imp...&nbsp;&nbsp;<a href='http://www.cppblog.com/fenglin/articles/129833.html'>阅读全文</a><img src ="http://www.cppblog.com/fenglin/aggbug/129833.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-14 12:40 <a href="http://www.cppblog.com/fenglin/articles/129833.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_防止重复提交</title><link>http://www.cppblog.com/fenglin/articles/129784.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Wed, 13 Oct 2010 14:42:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129784.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129784.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129784.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129784.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129784.html</trackback:ping><description><![CDATA[JSP代码片断：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form&nbsp;</span><span style="COLOR: #ff0000">action</span><span style="COLOR: #0000ff">="admin/Category_add"</span><span style="COLOR: #ff0000">&nbsp;method</span><span style="COLOR: #0000ff">="post"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">Name：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="text"</span><span style="COLOR: #ff0000">&nbsp;name</span><span style="COLOR: #0000ff">="category.name"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">Description:</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">textarea&nbsp;</span><span style="COLOR: #ff0000">rows</span><span style="COLOR: #0000ff">="5"</span><span style="COLOR: #ff0000">&nbsp;cols</span><span style="COLOR: #0000ff">="30"</span><span style="COLOR: #ff0000">&nbsp;name</span><span style="COLOR: #0000ff">="category.description"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">textarea</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="submit"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="add"</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;添加token标签，记录token值&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:token</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:token</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span></div>
struts.xml配置片断：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="Category_add"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.bbs.action.CategoryAction"</span><span style="COLOR: #ff0000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;method</span><span style="COLOR: #0000ff">="add"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/admin/Category_add.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;防止重复提交&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">interceptor-ref&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="defaultStack"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">interceptor-ref</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">interceptor-ref&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="token"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">interceptor-ref</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="invalid.token"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/error.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span></div>
在展现页面会自动生成一个token值，提交时会校验是否一致，如果一致，则正常提交，否则跳向错误页面。
<img src ="http://www.cppblog.com/fenglin/aggbug/129784.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-13 22:42 <a href="http://www.cppblog.com/fenglin/articles/129784.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_I18N 国际化</title><link>http://www.cppblog.com/fenglin/articles/129757.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Wed, 13 Oct 2010 08:25:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129757.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129757.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129757.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129757.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129757.html</trackback:ping><description><![CDATA[<p>I18N 国际化 Action级别：<br>&nbsp; 在Action同目录编写一个配置文件，名称为：&lt;Action文件名称&gt;_zh_CN.properties<br>&nbsp; 再在jsp文件里使用&lt;s:text name="key名称" /&gt;来获取配置。</p>
<p>I18N 国际化 package级别：<br>&nbsp; 文件名称只能以package为前缀，如package_zh_CN.properties</p>
<p>I18N 国际化 App级别：<br>&nbsp; 存放在src文件夹里，名称如bbs_zh_CN.properties<br>&nbsp; 在struts.xml里配置&lt;constant name="struts.custom.i18n.resources" value="bbs"&gt;&lt;/constant&gt;<br></p>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form&nbsp;</span><span style="COLOR: #ff0000">action</span><span style="COLOR: #0000ff">="admin/Login_login"</span><span style="COLOR: #ff0000">&nbsp;method</span><span style="COLOR: #0000ff">="post"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;直接取出配置文件里的内容&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;方法一&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:text&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="login.username"</span><span style="COLOR: #0000ff">/&gt;&lt;</span><span style="COLOR: #800000">input&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="text"</span><span style="COLOR: #ff0000">&nbsp;name</span><span style="COLOR: #0000ff">="username"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:text&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="login.password"</span><span style="COLOR: #0000ff">/&gt;&lt;</span><span style="COLOR: #800000">input&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="password"</span><span style="COLOR: #ff0000">&nbsp;name</span><span style="COLOR: #0000ff">="password"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;方法二&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="submit"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="&lt;s:property&nbsp;value="</span><span style="COLOR: #ff0000">getText('login.login')"</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">"/&gt;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span></div>
<p>&nbsp;</p>
<p><strong>动态语言切换<br></strong>在访问时加request_locale参数，即可实现动态切换语言各类，如：</p>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="admin/lang?request_locale=en_US"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">English</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="admin/lang?request_locale=zh_CN"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">简体中文</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span></div>
<p>&nbsp;</p>
<p>一般推荐使用App级别。<br></p>
<img src ="http://www.cppblog.com/fenglin/aggbug/129757.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-13 16:25 <a href="http://www.cppblog.com/fenglin/articles/129757.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>声明式异常处理</title><link>http://www.cppblog.com/fenglin/articles/129711.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Wed, 13 Oct 2010 01:07:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129711.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129711.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129711.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129711.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129711.html</trackback:ping><description><![CDATA[1、在Action中进行异常映射<br>2、在package中进行全局异常映射<br>3、使用继承共用异常映射<br>4、Struts2中异常处理由拦截器实现（interceptor)<br>&nbsp;a)实际上Struts2的大多数功能都由拦截器实现
<img src ="http://www.cppblog.com/fenglin/aggbug/129711.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-13 09:07 <a href="http://www.cppblog.com/fenglin/articles/129711.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_编码约定</title><link>http://www.cppblog.com/fenglin/articles/129456.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Mon, 11 Oct 2010 09:23:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129456.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129456.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129456.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129456.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129456.html</trackback:ping><description><![CDATA[<p>a)原则：简单就是美</p>
<p>b)库名：项目名称<br>c)表命名：<br>&nbsp;tab_Model名，如tab_User<br>d)字段命名：<br>&nbsp;保持和属性名一致（尽量不要起名和数据库命名冲突）<br>e)用层来划分包com.bebig.bbs.action,com.bebig.bbs.model,com.bebig.bbs.service，com.bebig.bbs.dto<br>包的名称应小写<br>f)Action类都是Action结尾，如UserAction<br>g)使用*-*的配置<br>h) / namespace前台路径<br>i) /admin namespace后台路径<br>j) package&nbsp; "action"</p>
<img src ="http://www.cppblog.com/fenglin/aggbug/129456.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-11 17:23 <a href="http://www.cppblog.com/fenglin/articles/129456.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_Theme</title><link>http://www.cppblog.com/fenglin/articles/129445.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Mon, 11 Oct 2010 08:16:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129445.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129445.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129445.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129445.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129445.html</trackback:ping><description><![CDATA[Theme包含四种：simple、xhtml（默认）、css_xhtml、ajax<br>定义自己的theme<br>直接复制simple主题到src\template目录里，再修改fielderror.flt（去除&lt;ul&gt;&lt;li&gt;标签）
<img src ="http://www.cppblog.com/fenglin/aggbug/129445.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-11 16:16 <a href="http://www.cppblog.com/fenglin/articles/129445.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_$#%的区别</title><link>http://www.cppblog.com/fenglin/articles/129439.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Mon, 11 Oct 2010 07:44:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129439.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129439.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129439.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129439.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129439.html</trackback:ping><description><![CDATA[a)$用于i18n和struts配置文件(传参数)<br>b)#取得ActionContext的值<br>c)%将原来的文本属性解析为ognl,对于本来就是ognl的属性不起作用 <br>%{}将字符串转为ognl表达式<br>
<img src ="http://www.cppblog.com/fenglin/aggbug/129439.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-11 15:44 <a href="http://www.cppblog.com/fenglin/articles/129439.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_常用的Tags</title><link>http://www.cppblog.com/fenglin/articles/129438.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Mon, 11 Oct 2010 07:43:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129438.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129438.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129438.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129438.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129438.html</trackback:ping><description><![CDATA[<strong>常用的Struts2标签有：property/set/bean/include/fielderror/param/debug、控制标签有：if/else/elseif/iterator<br>以下为这几种标签的演示代码：</strong><br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img id=Codehighlighter1_2_88_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_88_Open_Text.style.display='none'; Codehighlighter1_2_88_Closed_Image.style.display='inline'; Codehighlighter1_2_88_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2_88_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2_88_Closed_Text.style.display='none'; Codehighlighter1_2_88_Open_Image.style.display='inline'; Codehighlighter1_2_88_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2_88_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2_88_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">@&nbsp;page&nbsp;language</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">java</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;contentType</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">text/html;&nbsp;charset=GB18030</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;pageEncoding</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">GB18030</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_94_130_Open_Image onclick="this.style.display='none'; Codehighlighter1_94_130_Open_Text.style.display='none'; Codehighlighter1_94_130_Closed_Image.style.display='inline'; Codehighlighter1_94_130_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_94_130_Closed_Image onclick="this.style.display='none'; Codehighlighter1_94_130_Closed_Text.style.display='none'; Codehighlighter1_94_130_Open_Image.style.display='inline'; Codehighlighter1_94_130_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_94_130_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_94_130_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">@taglib&nbsp;uri</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">/struts-tags</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;prefix</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">s</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"&nbsp;"http://www.w3.org/TR/html4/loose.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta&nbsp;</span><span style="COLOR: #ff0000">http-equiv</span><span style="COLOR: #0000ff">="Content-Type"</span><span style="COLOR: #ff0000">&nbsp;content</span><span style="COLOR: #0000ff">="text/html;&nbsp;charset=GB18030"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Struts&nbsp;Tags</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">ol</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">property：&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="username"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">&nbsp;|&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="password"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">property取值为字符串：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="'username'"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">property设定默认值：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="admin"</span><span style="COLOR: #ff0000">&nbsp;default</span><span style="COLOR: #0000ff">="管理员"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">property设定HTML:</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="'&lt;hr&nbsp;/&gt;'"</span><span style="COLOR: #ff0000">&nbsp;escapeHtml</span><span style="COLOR: #0000ff">="false"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">hr&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">set设定adminName值(默认为request和ActionContext)</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:set<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #ff0000">var</span><span style="COLOR: #0000ff">="adminName"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="username"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">set&nbsp;从request取值：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#request.adminName"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">set,&nbsp;Get&nbsp;value&nbsp;from&nbsp;ActionContext:</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#adminName"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">set,&nbsp;Set&nbsp;range.</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:set&nbsp;</span><span style="COLOR: #ff0000">var</span><span style="COLOR: #0000ff">="adminPassword"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="password"</span><span style="COLOR: #ff0000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scope</span><span style="COLOR: #0000ff">="page"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">set,Get&nbsp;value&nbsp;from&nbsp;this&nbsp;range:</span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">pageContext.getAttribute(</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">adminPassword</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">)</span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">set,Set&nbsp;var,range&nbsp;is&nbsp;ActionContext.</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:set&nbsp;</span><span style="COLOR: #ff0000">var</span><span style="COLOR: #0000ff">="adminPassword"</span><span style="COLOR: #ff0000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value</span><span style="COLOR: #0000ff">="'haha'"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">set,Use&nbsp;#&nbsp;get&nbsp;value:</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#adminPassword"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">hr&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">bean&nbsp;View&nbsp;debug&nbsp;description:&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:bean<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="com.bebig.struts2.tags.Dog"</span><span style="COLOR: #ff0000">&nbsp;var</span><span style="COLOR: #0000ff">="myDog"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:param&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="name"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="'oydy'"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:param</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:bean</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">include:&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:include&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="/include1.html"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:include</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">hr&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">fielderror:&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:fielderror&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="field.test"</span><span style="COLOR: #ff0000">&nbsp;theme</span><span style="COLOR: #0000ff">="simple"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:fielderror</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">hr&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">age=</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#parameters.age[0]"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:set<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #ff0000">var</span><span style="COLOR: #0000ff">="age"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="#parameters.age[0]"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:set</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:if&nbsp;</span><span style="COLOR: #ff0000">test</span><span style="COLOR: #0000ff">="#age&lt;0"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">error!</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:if</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:elseif&nbsp;</span><span style="COLOR: #ff0000">test</span><span style="COLOR: #0000ff">="#age&lt;20"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">too&nbsp;young!</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:elseif</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:else</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">ok.</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:else</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">hr&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">集合遍历：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:iterator&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="{1,2,3}"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:iterator</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">集合遍历：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:iterator&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="{1,2,3}"</span><span style="COLOR: #ff0000">&nbsp;status</span><span style="COLOR: #0000ff">="s"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">当前为第</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#s.count"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">个元素，元素索引为</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#s.index"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;值为奇数？</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#s.odd"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">值为偶数？</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#s.even"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;为第一个元素？</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#s.first"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;为最后一个元素？</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#s.last"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:iterator</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">集合遍历：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:iterator&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="{'aaa','bbb','ccc'}"</span><span style="COLOR: #ff0000">&nbsp;var</span><span style="COLOR: #0000ff">="list"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#list.toUpperCase()"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:iterator</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">集合遍历：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:iterator&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#{1:'aaa',2:'bbb',3:'ccc'}"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="key"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">&nbsp;|&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="value"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:iterator</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">集合遍历：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:iterator&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#{1:'aaa',2:'bbb',3:'ccc'}"</span><span style="COLOR: #ff0000">&nbsp;var</span><span style="COLOR: #0000ff">="map"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#map.key"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">&nbsp;|&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#map.value.toUpperCase()"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:iterator</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">li</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">ol</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:debug</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:debug</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div>
<img src ="http://www.cppblog.com/fenglin/aggbug/129438.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-11 15:43 <a href="http://www.cppblog.com/fenglin/articles/129438.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_OGNL</title><link>http://www.cppblog.com/fenglin/articles/129362.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sun, 10 Oct 2010 12:20:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129362.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129362.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129362.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129362.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129362.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: OGNL(Object Graph Navigation Language)对象图导航语言，以下为演示代码。OgnlAction.javapackage&nbsp;com.bebig.struts2.ognl;import&nbsp;java.util.ArrayList;import&nbsp;java.util.HashMap;import&nbsp;java.util.HashSet;i...&nbsp;&nbsp;<a href='http://www.cppblog.com/fenglin/articles/129362.html'>阅读全文</a><img src ="http://www.cppblog.com/fenglin/aggbug/129362.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-10 20:20 <a href="http://www.cppblog.com/fenglin/articles/129362.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_Result总结</title><link>http://www.cppblog.com/fenglin/articles/129312.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sun, 10 Oct 2010 01:47:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129312.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129312.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129312.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129312.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129312.html</trackback:ping><description><![CDATA[<p>1、常用四种类型<br>&nbsp; a)dispatcher(默认)<br>&nbsp; b)redirect<br>&nbsp; c)chain<br>&nbsp; d)redirectAction<br>前两种常用</p>
<p>2.全局结果集<br>global-results | extends</p>
<p>3.动态结果（了解）<br>在action中保存一个属性，存储具体的结果location</p>
<p>4.传递参数<br>&nbsp; a)客户端跳转才需要传递<br>&nbsp; b)${}表达式（不是EL）</p>
<img src ="http://www.cppblog.com/fenglin/aggbug/129312.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-10 09:47 <a href="http://www.cppblog.com/fenglin/articles/129312.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_带参数的结果集</title><link>http://www.cppblog.com/fenglin/articles/129309.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sun, 10 Oct 2010 01:36:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129309.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129309.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129309.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129309.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129309.html</trackback:ping><description><![CDATA[一次Request请求只有一个值栈（Value Stack）。<br>Action才有Value Stack，JSP页面没有，如果在JSP页面里想取参数值，可以从Stack Context中获取。<br>因此，在result的type="redirect"时，如果有传参数，可以从Stack Context中获取。<br>struts.xml<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"&nbsp;</span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;struts&nbsp;PUBLIC<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"-//Apache&nbsp;Software&nbsp;Foundation//DTD&nbsp;Struts&nbsp;Configuration&nbsp;2.0//EN"<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"http://struts.apache.org/dtds/struts-2.0.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">constant&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="struts.devMode"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="true"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="user"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/user"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="user"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.user.action.UserAction"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;用$符号来取Value&nbsp;Stack里的值&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="redirect"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/success.jsp?t=${type}</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span></div>
测试页面代码片断：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">ul</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;success.<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">ul</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="t"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">从Value&nbsp;Stack里取不到t的值，因为JSP页面是没有Value&nbsp;Stack的。<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="#parameters.t"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">这里从Stack&nbsp;Context里取得t的值。<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:debug</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:debug</span><span style="COLOR: #0000ff">&gt;</span></div>
<br>
<img src ="http://www.cppblog.com/fenglin/aggbug/129309.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-10 09:36 <a href="http://www.cppblog.com/fenglin/articles/129309.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_动态结果集_dynamic_result</title><link>http://www.cppblog.com/fenglin/articles/129302.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sun, 10 Oct 2010 00:53:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129302.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129302.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129302.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129302.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129302.html</trackback:ping><description><![CDATA[UserAction.java<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000">&nbsp;com.bebig.struts2.user.action;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000">&nbsp;com.opensymphony.xwork2.ActionSupport;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img id=Codehighlighter1_133_590_Open_Image onclick="this.style.display='none'; Codehighlighter1_133_590_Open_Text.style.display='none'; Codehighlighter1_133_590_Closed_Image.style.display='inline'; Codehighlighter1_133_590_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_133_590_Closed_Image onclick="this.style.display='none'; Codehighlighter1_133_590_Closed_Text.style.display='none'; Codehighlighter1_133_590_Open_Image.style.display='inline'; Codehighlighter1_133_590_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;UserAction&nbsp;</span><span style="COLOR: #0000ff">extends</span><span style="COLOR: #000000">&nbsp;ActionSupport&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_133_590_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_133_590_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;type;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">&nbsp;String&nbsp;r;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img id=Codehighlighter1_196_211_Open_Image onclick="this.style.display='none'; Codehighlighter1_196_211_Open_Text.style.display='none'; Codehighlighter1_196_211_Closed_Image.style.display='inline'; Codehighlighter1_196_211_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_196_211_Closed_Image onclick="this.style.display='none'; Codehighlighter1_196_211_Closed_Text.style.display='none'; Codehighlighter1_196_211_Open_Image.style.display='inline'; Codehighlighter1_196_211_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;String&nbsp;getR()&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_196_211_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_196_211_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;r;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img id=Codehighlighter1_242_259_Open_Image onclick="this.style.display='none'; Codehighlighter1_242_259_Open_Text.style.display='none'; Codehighlighter1_242_259_Closed_Image.style.display='inline'; Codehighlighter1_242_259_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_242_259_Closed_Image onclick="this.style.display='none'; Codehighlighter1_242_259_Closed_Text.style.display='none'; Codehighlighter1_242_259_Open_Image.style.display='inline'; Codehighlighter1_242_259_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;setR(String&nbsp;r)&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_242_259_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_242_259_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.r&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;r;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img id=Codehighlighter1_293_316_Open_Image onclick="this.style.display='none'; Codehighlighter1_293_316_Open_Text.style.display='none'; Codehighlighter1_293_316_Closed_Image.style.display='inline'; Codehighlighter1_293_316_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_293_316_Closed_Image onclick="this.style.display='none'; Codehighlighter1_293_316_Closed_Text.style.display='none'; Codehighlighter1_293_316_Open_Image.style.display='inline'; Codehighlighter1_293_316_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;setType(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;type)&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_293_316_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_293_316_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.type&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;type;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img id=Codehighlighter1_341_359_Open_Image onclick="this.style.display='none'; Codehighlighter1_341_359_Open_Text.style.display='none'; Codehighlighter1_341_359_Closed_Image.style.display='inline'; Codehighlighter1_341_359_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_341_359_Closed_Image onclick="this.style.display='none'; Codehighlighter1_341_359_Closed_Text.style.display='none'; Codehighlighter1_341_359_Open_Image.style.display='inline'; Codehighlighter1_341_359_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;getType()&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_341_359_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_341_359_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;type;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;@Override<br><img id=Codehighlighter1_398_587_Open_Image onclick="this.style.display='none'; Codehighlighter1_398_587_Open_Text.style.display='none'; Codehighlighter1_398_587_Closed_Image.style.display='inline'; Codehighlighter1_398_587_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_398_587_Closed_Image onclick="this.style.display='none'; Codehighlighter1_398_587_Closed_Text.style.display='none'; Codehighlighter1_398_587_Open_Image.style.display='inline'; Codehighlighter1_398_587_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;String&nbsp;execute()&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_398_587_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_398_587_Open_Text><span style="COLOR: #000000">{<br><img id=Codehighlighter1_417_463_Open_Image onclick="this.style.display='none'; Codehighlighter1_417_463_Open_Text.style.display='none'; Codehighlighter1_417_463_Closed_Image.style.display='inline'; Codehighlighter1_417_463_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_417_463_Closed_Image onclick="this.style.display='none'; Codehighlighter1_417_463_Closed_Text.style.display='none'; Codehighlighter1_417_463_Open_Image.style.display='inline'; Codehighlighter1_417_463_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(type&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_417_463_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_417_463_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">/success.jsp</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;SUCCESS;<br><img id=Codehighlighter1_485_527_Open_Image onclick="this.style.display='none'; Codehighlighter1_485_527_Open_Text.style.display='none'; Codehighlighter1_485_527_Closed_Image.style.display='inline'; Codehighlighter1_485_527_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_485_527_Closed_Image onclick="this.style.display='none'; Codehighlighter1_485_527_Closed_Text.style.display='none'; Codehighlighter1_485_527_Open_Image.style.display='inline'; Codehighlighter1_485_527_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(type&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_485_527_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_485_527_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">/error.jsp</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;ERROR;<br><img id=Codehighlighter1_534_584_Open_Image onclick="this.style.display='none'; Codehighlighter1_534_584_Open_Text.style.display='none'; Codehighlighter1_534_584_Closed_Image.style.display='inline'; Codehighlighter1_534_584_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_534_584_Closed_Image onclick="this.style.display='none'; Codehighlighter1_534_584_Closed_Text.style.display='none'; Codehighlighter1_534_584_Open_Image.style.display='inline'; Codehighlighter1_534_584_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_534_584_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_534_584_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">/mainpage.jsp</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">mainpage</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
struts.xml片断：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="user"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.user.action.UserAction"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;用$符号来取Value&nbsp;Stack里的值&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">${r}</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="error"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">${r}</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span></div>
<img src ="http://www.cppblog.com/fenglin/aggbug/129302.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-10 08:53 <a href="http://www.cppblog.com/fenglin/articles/129302.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_全局结果集(Global Result)</title><link>http://www.cppblog.com/fenglin/articles/129255.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 14:45:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129255.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129255.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129255.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129255.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129255.html</trackback:ping><description><![CDATA[struts.xml<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"&nbsp;</span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;struts&nbsp;PUBLIC<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"-//Apache&nbsp;Software&nbsp;Foundation//DTD&nbsp;Struts&nbsp;Configuration&nbsp;2.0//EN"<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"http://struts.apache.org/dtds/struts-2.0.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">constant&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="struts.devMode"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="true"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="user"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/user"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">default-action-ref&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="index"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">default-action-ref</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;全局结果集，本包内及继承自本包的Action可用&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">global-results</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="mainpage"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/mainpage.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">global-results</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="index"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/index.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="r1"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.user.action.UserAction"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;/success.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="error"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;/error.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;继承自user包，因此可以使用user包的全局结果集&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="admin"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/admin"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="user"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="admin"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.user.action.AdminAction"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;/success.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
<img src ="http://www.cppblog.com/fenglin/aggbug/129255.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 22:45 <a href="http://www.cppblog.com/fenglin/articles/129255.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_ResultType</title><link>http://www.cppblog.com/fenglin/articles/129250.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 13:32:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129250.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129250.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129250.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129250.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129250.html</trackback:ping><description><![CDATA[struts.xml<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"&nbsp;</span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;struts&nbsp;PUBLIC<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"-//Apache&nbsp;Software&nbsp;Foundation//DTD&nbsp;Struts&nbsp;Configuration&nbsp;2.0//EN"<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"http://struts.apache.org/dtds/struts-2.0.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">constant&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="struts.devMode"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="true"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="resultType"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/r"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">default-action-ref&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="index"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">default-action-ref</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="index"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/index.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;服务器端跳转到视图,dispatcher为默认类型，如果不指定，则为此类型&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="r1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="dispatcher"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;/r1.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;客户端跳转到视图&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="r2"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="redirect"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;/r2.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;服务器端跳转到Action&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="r3"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="chain"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;r1</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;客户端跳转到Action&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="r4"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="redirectAction"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">r2<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;客户端跳转到其它包的Action&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="r5"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="redirectAction"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">param&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="actionName"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">k1</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">param</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">param&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="namespace"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/t</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">param</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;Result类型:&nbsp;1、dispatcher&nbsp;2、redirect&nbsp;3、chain&nbsp;4、redirectAction&nbsp;5、freemarker&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.httpheader&nbsp;7.stream&nbsp;8.velocity&nbsp;9.xslt&nbsp;10.plaintext&nbsp;11.tiles&nbsp;其中前四种最为常用&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="test"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/t"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="k1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="dispatcher"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;/r1.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
<img src ="http://www.cppblog.com/fenglin/aggbug/129250.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 21:32 <a href="http://www.cppblog.com/fenglin/articles/129250.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_Action总结</title><link>http://www.cppblog.com/fenglin/articles/129248.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 13:05:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129248.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129248.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129248.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129248.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129248.html</trackback:ping><description><![CDATA[1、实现一个Action的最常用方式：从ActionSupport继承<br>2、DMI动态方法调用！<br>3、通配符配置*{1}{2}...<br>4、接收参数的方法（一般用属性或者DomainModel来接收）<br>5、简单参数验证addFieldError<br>&nbsp; a)一般不使用Struts2的UI标签<br>6、访问Web元素<br>&nbsp; a)Map类型<br>&nbsp;&nbsp;&nbsp; IoC（Inverse of control)<br>&nbsp;&nbsp;&nbsp; 依赖Struts2<br>&nbsp; b)原始类型<br>&nbsp;&nbsp;&nbsp; IoC（Inverse of control)<br>&nbsp;&nbsp;&nbsp; 依赖Struts2<br>7、包含文件配置<br>8、默认action处理
<img src ="http://www.cppblog.com/fenglin/aggbug/129248.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 21:05 <a href="http://www.cppblog.com/fenglin/articles/129248.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_默认Action(default action)</title><link>http://www.cppblog.com/fenglin/articles/129247.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 12:55:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129247.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129247.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129247.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129247.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129247.html</trackback:ping><description><![CDATA[struts.xml<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"&nbsp;</span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;struts&nbsp;PUBLIC<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"-//Apache&nbsp;Software&nbsp;Foundation//DTD&nbsp;Struts&nbsp;Configuration&nbsp;2.0//EN"<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"http://struts.apache.org/dtds/struts-2.0.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">constant&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="struts.devMode"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="true"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="default"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;如果找不到用户输入的Action，则默认跳转到此Action&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">default-action-ref&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="index"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">default-action-ref</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="index"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">&nbsp;/index.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="login*"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.user.action.LoginAction{1}"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/user_login_success.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="error"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/user_login_error.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
<img src ="http://www.cppblog.com/fenglin/aggbug/129247.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 20:55 <a href="http://www.cppblog.com/fenglin/articles/129247.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_包含文件(include file)</title><link>http://www.cppblog.com/fenglin/articles/129244.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 12:43:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129244.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129244.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129244.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129244.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129244.html</trackback:ping><description><![CDATA[struts.xml<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"&nbsp;</span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;struts&nbsp;PUBLIC<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"-//Apache&nbsp;Software&nbsp;Foundation//DTD&nbsp;Struts&nbsp;Configuration&nbsp;2.0//EN"<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"http://struts.apache.org/dtds/struts-2.0.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;Add&nbsp;packages&nbsp;here&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">constant&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="struts.devMode"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="true"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">include&nbsp;</span><span style="COLOR: #ff0000">file</span><span style="COLOR: #0000ff">="login.xml"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">include</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
login.xml<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"&nbsp;</span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;struts&nbsp;PUBLIC<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"-//Apache&nbsp;Software&nbsp;Foundation//DTD&nbsp;Struts&nbsp;Configuration&nbsp;2.0//EN"<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"http://struts.apache.org/dtds/struts-2.0.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">constant&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="struts.devMode"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="true"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="login"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/login"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="login*"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.user.action.LoginAction{1}"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/user_login_success.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="error"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/user_login_error.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
<span style="COLOR: red"><strong>在团队协作开发过程中，会将各模块分配给不同的开发人员开发，最后通过这种方法合并配置，从而不会相互影响到。</strong></span>
<img src ="http://www.cppblog.com/fenglin/aggbug/129244.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 20:43 <a href="http://www.cppblog.com/fenglin/articles/129244.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_访问Web元素(Access Web Elements)</title><link>http://www.cppblog.com/fenglin/articles/129242.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 12:22:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129242.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129242.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129242.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129242.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129242.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 访问Web元素可以有四种方法，下面依次列出，三个视图文件源码：index.jsp&lt;%@&nbsp;page&nbsp;language="java"&nbsp;contentType="text/html;&nbsp;charset=utf-8"&nbsp;&nbsp;&nbsp;&nbsp;pageEncoding="utf-8"%&gt;&lt;!DOCTYPE&nbsp;html&...&nbsp;&nbsp;<a href='http://www.cppblog.com/fenglin/articles/129242.html'>阅读全文</a><img src ="http://www.cppblog.com/fenglin/aggbug/129242.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 20:22 <a href="http://www.cppblog.com/fenglin/articles/129242.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_简单数据验证(Simple Data Validation)</title><link>http://www.cppblog.com/fenglin/articles/129218.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 09:08:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129218.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129218.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129218.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129218.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129218.html</trackback:ping><description><![CDATA[UserAction.java<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000">&nbsp;com.bebig.struts2.user.action;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000">&nbsp;com.opensymphony.xwork2.ActionSupport;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img id=Codehighlighter1_134_430_Open_Image onclick="this.style.display='none'; Codehighlighter1_134_430_Open_Text.style.display='none'; Codehighlighter1_134_430_Closed_Image.style.display='inline'; Codehighlighter1_134_430_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_134_430_Closed_Image onclick="this.style.display='none'; Codehighlighter1_134_430_Closed_Text.style.display='none'; Codehighlighter1_134_430_Open_Image.style.display='inline'; Codehighlighter1_134_430_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;UserAction&nbsp;</span><span style="COLOR: #0000ff">extends</span><span style="COLOR: #000000">&nbsp;ActionSupport&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_134_430_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_134_430_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">&nbsp;String&nbsp;name;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img id=Codehighlighter1_181_318_Open_Image onclick="this.style.display='none'; Codehighlighter1_181_318_Open_Text.style.display='none'; Codehighlighter1_181_318_Closed_Image.style.display='inline'; Codehighlighter1_181_318_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_181_318_Closed_Image onclick="this.style.display='none'; Codehighlighter1_181_318_Closed_Text.style.display='none'; Codehighlighter1_181_318_Open_Image.style.display='inline'; Codehighlighter1_181_318_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;String&nbsp;add()&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_181_318_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_181_318_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(name</span><span style="COLOR: #000000">==</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">name.equals(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">admin</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">))<br><img id=Codehighlighter1_227_297_Open_Image onclick="this.style.display='none'; Codehighlighter1_227_297_Open_Text.style.display='none'; Codehighlighter1_227_297_Closed_Image.style.display='inline'; Codehighlighter1_227_297_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_227_297_Closed_Image onclick="this.style.display='none'; Codehighlighter1_227_297_Closed_Text.style.display='none'; Codehighlighter1_227_297_Open_Image.style.display='inline'; Codehighlighter1_227_297_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_227_297_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_227_297_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.addFieldError(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">name</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Name&nbsp;is&nbsp;error!</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;ERROR;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;SUCCESS;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img id=Codehighlighter1_356_379_Open_Image onclick="this.style.display='none'; Codehighlighter1_356_379_Open_Text.style.display='none'; Codehighlighter1_356_379_Closed_Image.style.display='inline'; Codehighlighter1_356_379_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_356_379_Closed_Image onclick="this.style.display='none'; Codehighlighter1_356_379_Closed_Text.style.display='none'; Codehighlighter1_356_379_Open_Image.style.display='inline'; Codehighlighter1_356_379_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;setName(String&nbsp;name)&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_356_379_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_356_379_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.name&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;name;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img id=Codehighlighter1_408_426_Open_Image onclick="this.style.display='none'; Codehighlighter1_408_426_Open_Text.style.display='none'; Codehighlighter1_408_426_Closed_Image.style.display='inline'; Codehighlighter1_408_426_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_408_426_Closed_Image onclick="this.style.display='none'; Codehighlighter1_408_426_Closed_Text.style.display='none'; Codehighlighter1_408_426_Open_Image.style.display='inline'; Codehighlighter1_408_426_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;String&nbsp;getName()&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_408_426_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_408_426_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;name;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
struts.xml代码片断：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="user"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/user"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="userAdd"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.user.action.UserAction"</span><span style="COLOR: #ff0000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;method</span><span style="COLOR: #0000ff">="add"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/user_add_success.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="error"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/user_add_error.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span></div>
index.jsp<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img id=Codehighlighter1_2_84_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Open_Text.style.display='none'; Codehighlighter1_2_84_Closed_Image.style.display='inline'; Codehighlighter1_2_84_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2_84_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Closed_Text.style.display='none'; Codehighlighter1_2_84_Open_Image.style.display='inline'; Codehighlighter1_2_84_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2_84_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2_84_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">@&nbsp;page&nbsp;language</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">java</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;contentType</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">text/html;&nbsp;charset=utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;pageEncoding</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"&nbsp;"http://www.w3.org/TR/html4/loose.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta&nbsp;</span><span style="COLOR: #ff0000">http-equiv</span><span style="COLOR: #0000ff">="Content-Type"</span><span style="COLOR: #ff0000">&nbsp;content</span><span style="COLOR: #0000ff">="text/html;&nbsp;charset=ISO-8859-1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Simple&nbsp;Data&nbsp;Validation</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form&nbsp;</span><span style="COLOR: #ff0000">action</span><span style="COLOR: #0000ff">="user/userAdd.action"</span><span style="COLOR: #ff0000">&nbsp;method</span><span style="COLOR: #0000ff">="post"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">p</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">姓名:</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">p</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="text"</span><span style="COLOR: #ff0000">&nbsp;name</span><span style="COLOR: #0000ff">="name"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">input&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="submit"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div>
user_add_error.jsp<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img id=Codehighlighter1_2_84_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Open_Text.style.display='none'; Codehighlighter1_2_84_Closed_Image.style.display='inline'; Codehighlighter1_2_84_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2_84_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Closed_Text.style.display='none'; Codehighlighter1_2_84_Open_Image.style.display='inline'; Codehighlighter1_2_84_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2_84_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2_84_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">@&nbsp;page&nbsp;language</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">java</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;contentType</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">text/html;&nbsp;charset=utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;pageEncoding</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_90_126_Open_Image onclick="this.style.display='none'; Codehighlighter1_90_126_Open_Text.style.display='none'; Codehighlighter1_90_126_Closed_Image.style.display='inline'; Codehighlighter1_90_126_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_90_126_Closed_Image onclick="this.style.display='none'; Codehighlighter1_90_126_Closed_Text.style.display='none'; Codehighlighter1_90_126_Open_Image.style.display='inline'; Codehighlighter1_90_126_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_90_126_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_90_126_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">@taglib&nbsp;uri</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">/struts-tags</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;prefix</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">s</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"&nbsp;"http://www.w3.org/TR/html4/loose.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta&nbsp;</span><span style="COLOR: #ff0000">http-equiv</span><span style="COLOR: #0000ff">="Content-Type"</span><span style="COLOR: #ff0000">&nbsp;content</span><span style="COLOR: #0000ff">="text/html;&nbsp;charset=ISO-8859-1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">error</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_343_509_Open_Image onclick="this.style.display='none'; Codehighlighter1_343_509_Open_Text.style.display='none'; Codehighlighter1_343_509_Closed_Image.style.display='inline'; Codehighlighter1_343_509_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_343_509_Closed_Image onclick="this.style.display='none'; Codehighlighter1_343_509_Closed_Text.style.display='none'; Codehighlighter1_343_509_Open_Image.style.display='inline'; Codehighlighter1_343_509_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_343_509_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_343_509_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #0000ff">String</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;path&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getContextPath();<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #0000ff">String</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;basePath&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getScheme()&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">://</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getServerName()&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">:</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getServerPort()<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;path&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">/</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">base&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="&lt;%=basePath%&gt;"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;使用base标签指定本页面所有链接的参照路径&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">p</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">User&nbsp;add&nbsp;error.</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">p</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:fielderror&nbsp;</span><span style="COLOR: #ff0000">fieldName</span><span style="COLOR: #0000ff">="name"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:fielderror</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:property&nbsp;</span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="errors.name[0]"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:property</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:debug</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">s:debug</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div>
user_add_success.jsp<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img id=Codehighlighter1_2_84_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Open_Text.style.display='none'; Codehighlighter1_2_84_Closed_Image.style.display='inline'; Codehighlighter1_2_84_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2_84_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Closed_Text.style.display='none'; Codehighlighter1_2_84_Open_Image.style.display='inline'; Codehighlighter1_2_84_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2_84_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2_84_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">@&nbsp;page&nbsp;language</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">java</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;contentType</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">text/html;&nbsp;charset=utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;pageEncoding</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"&nbsp;"http://www.w3.org/TR/html4/loose.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta&nbsp;</span><span style="COLOR: #ff0000">http-equiv</span><span style="COLOR: #0000ff">="Content-Type"</span><span style="COLOR: #ff0000">&nbsp;content</span><span style="COLOR: #0000ff">="text/html;&nbsp;charset=ISO-8859-1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Struts2_Path</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_308_474_Open_Image onclick="this.style.display='none'; Codehighlighter1_308_474_Open_Text.style.display='none'; Codehighlighter1_308_474_Closed_Image.style.display='inline'; Codehighlighter1_308_474_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_308_474_Closed_Image onclick="this.style.display='none'; Codehighlighter1_308_474_Closed_Text.style.display='none'; Codehighlighter1_308_474_Open_Image.style.display='inline'; Codehighlighter1_308_474_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_308_474_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_308_474_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #0000ff">String</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;path&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getContextPath();<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #0000ff">String</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;basePath&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getScheme()&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">://</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getServerName()&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">:</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getServerPort()<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;path&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">/</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">base&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="&lt;%=basePath%&gt;"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;使用base标签指定本页面所有链接的参照路径&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">p</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">User&nbsp;add&nbsp;success.</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">p</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div>
<img src ="http://www.cppblog.com/fenglin/aggbug/129218.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 17:08 <a href="http://www.cppblog.com/fenglin/articles/129218.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_三种传参数方法</title><link>http://www.cppblog.com/fenglin/articles/129212.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 08:53:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129212.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129212.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129212.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129212.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129212.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 1、通过属性传参数(Attr)UserAction.javapackage&nbsp;com.bebig.struts2.user.action;import&nbsp;com.opensymphony.xwork2.ActionSupport;public&nbsp;class&nbsp;UserAction&nbsp;extends&nbsp;ActionSupport&nbsp;{&nb...&nbsp;&nbsp;<a href='http://www.cppblog.com/fenglin/articles/129212.html'>阅读全文</a><img src ="http://www.cppblog.com/fenglin/aggbug/129212.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 16:53 <a href="http://www.cppblog.com/fenglin/articles/129212.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PO/POJO/BO/DTO/VO的区别</title><link>http://www.cppblog.com/fenglin/articles/129176.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 03:34:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129176.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129176.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129176.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129176.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129176.html</trackback:ping><description><![CDATA[<span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=Apple-style-span><span style="TEXT-ALIGN: left; LINE-HEIGHT: 18px; FONT-FAMILY: Arial, sans-serif, Helvetica, Tahoma; FONT-SIZE: 12px" class=Apple-style-span>PO ：persistent object持久对象<span class=Apple-converted-space>&nbsp;</span><br><br>1 ．有时也被称为Data对象，对应数据库中的entity，可以简单认为一个PO对应数据库中的一条记录。<span class=Apple-converted-space>&nbsp;</span><br><br>2 ．在hibernate持久化框架中与insert/delet操作密切相关。<span class=Apple-converted-space>&nbsp;</span><br><br>3 ．PO中不应该包含任何对数据库的操作。<span class=Apple-converted-space>&nbsp;</span><br><br>POJO ：plain ordinary java object 无规则简单java对象<span class=Apple-converted-space>&nbsp;</span><br><br>一个中间对象，可以转化为PO、DTO、VO。<span class=Apple-converted-space>&nbsp;</span><br><br>1 ．POJO持久化之后==〉PO<span class=Apple-converted-space>&nbsp;</span><br><br>（在运行期，由Hibernate中的cglib动态把POJO转换为PO，PO相对于POJO会增加一些用来管理数据库entity状态的属性和方法。PO对于programmer来说完全透明，由于是运行期生成PO，所以可以支持增量编译，增量调试。）<span class=Apple-converted-space>&nbsp;</span><br><br>2 ．POJO传输过程中==〉DTO<span class=Apple-converted-space>&nbsp;</span><br><br>3 ．POJO用作表示层==〉VO<span class=Apple-converted-space>&nbsp;</span><br><br>PO 和VO都应该属于它。<span class=Apple-converted-space>&nbsp;</span><br><br>BO ：business object 业务对象<span class=Apple-converted-space>&nbsp;</span><br><br>封装业务逻辑为一个对象（可以包括多个PO，通常需要将BO转化成PO，才能进行数据的持久化，反之，从DB中得到的PO，需要转化成BO才能在业务层使用）。<span class=Apple-converted-space>&nbsp;</span><br><br>关于BO主要有三种概念<span class=Apple-converted-space>&nbsp;</span><br><br>1 、只包含业务对象的属性；<span class=Apple-converted-space>&nbsp;</span><br><br>2 、只包含业务方法；<span class=Apple-converted-space>&nbsp;</span><br><br>3 、两者都包含。<span class=Apple-converted-space>&nbsp;</span><br><br>在实际使用中，认为哪一种概念正确并不重要，关键是实际应用中适合自己项目的需要。<span class=Apple-converted-space>&nbsp;</span><br><br>VO ：value object值对象 / view object表现层对象<span class=Apple-converted-space>&nbsp;</span><br><br>1 ．主要对应页面显示（web页面/swt、swing界面）的数据对象。<span class=Apple-converted-space>&nbsp;</span><br><br>2 ．可以和表对应，也可以不，这根据业务的需要。<span class=Apple-converted-space>&nbsp;</span><br><br>注 ：在struts中，用ActionForm做VO，需要做一个转换，因为PO是面向对象的，而ActionForm是和view对应的，要将几个PO要显示的属性合成一个ActionForm，可以使用BeanUtils的copy方法。<span class=Apple-converted-space>&nbsp;</span><br><br>DTO （TO） ：Data Transfer Object数据传输对象<span class=Apple-converted-space>&nbsp;</span><br><br>1 ．用在需要跨进程或远程传输时，它不应该包含业务逻辑。<span class=Apple-converted-space>&nbsp;</span><br><br>2 ．比如一张表有100个字段，那么对应的PO就有100个属性（大多数情况下，DTO 内的数据来自多个表）。但view层只需显示10个字段，没有必要把整个PO对象传递到client，这时我们就可以用只有这10个属性的DTO来传输数据到client，这样也不会暴露server端表结构。到达客户端以后，如果用这个对象来对应界面显示，那此时它的身份就转为VO。<span class=Apple-converted-space>&nbsp;</span><br><br><br>DAO ：data access object数据访问对象<span class=Apple-converted-space>&nbsp;</span><br><br>1 ．主要用来封装对DB的访问（CRUD操作）。<span class=Apple-converted-space>&nbsp;</span><br><br>2 ．通过接收Business层的数据，把POJO持久化为PO。<span class=Apple-converted-space>&nbsp;</span></span></span>
<img src ="http://www.cppblog.com/fenglin/aggbug/129176.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 11:34 <a href="http://www.cppblog.com/fenglin/articles/129176.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_通配符（Wildcard）</title><link>http://www.cppblog.com/fenglin/articles/129170.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 02:55:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129170.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129170.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129170.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129170.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129170.html</trackback:ping><description><![CDATA[如果存在多个名称类似的Action，首先匹配最精确的Action。<br>使用通配符，将配置量降到最低。<br>不过，一定要遵守&#8220;<span style="COLOR: red"><strong>约定优于配置</strong></span>&#8221;的原则。<br><br>struts.xml配置代码片断：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="actions"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/actions"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="Student*"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.action.StudentAction"</span><span style="COLOR: #ff0000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;method</span><span style="COLOR: #0000ff">="{1}"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/Student_{1}_success.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="*_*"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.action.{1}Action"</span><span style="COLOR: #ff0000">&nbsp;method</span><span style="COLOR: #0000ff">="{2}"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/{1}_{2}_success.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span></div>
调用方法：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="actions/Studentadd.action"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">添加学生</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="actions/Studentdelete.action"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">删除学生</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="actions/Teacher_add"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">添加老师</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="actions/Teacher_delete"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">删除老师</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span></div>
<img src ="http://www.cppblog.com/fenglin/aggbug/129170.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 10:55 <a href="http://www.cppblog.com/fenglin/articles/129170.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2_ActionMethod_DMI</title><link>http://www.cppblog.com/fenglin/articles/129162.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Sat, 09 Oct 2010 01:47:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129162.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129162.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129162.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129162.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129162.html</trackback:ping><description><![CDATA[Action执行的时候并不一定要执行execute方法。<br>可以在配置文件中配置Action的时候用method=来指定执行哪个方法,也可以在URL地址中动态指定（动态方法调用DMI）<span style="COLOR: red"><strong>（推荐使用DMI方法）</strong></span>。<br><span style="COLOR: red"><u>DMI(dynamic method invoke)</u></span><br>struts.xml配置片断代码：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="user"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/user"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;Method方法&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="userAdd"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.user.action.UserAction"</span><span style="COLOR: #ff0000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;method</span><span style="COLOR: #0000ff">="add"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/user_add_success.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;DMI方法&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="user"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.user.action.UserAction"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/user_add_success.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span></div>
调用方法：<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">Method调用方法</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="user/userAdd.action"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">添加用户</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">DMI调用方法</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="user/user!add"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">添加用户</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span></div>
<img src ="http://www.cppblog.com/fenglin/aggbug/129162.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 09:47 <a href="http://www.cppblog.com/fenglin/articles/129162.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts_路径(Path)问题</title><link>http://www.cppblog.com/fenglin/articles/129108.html</link><dc:creator>风林</dc:creator><author>风林</author><pubDate>Fri, 08 Oct 2010 16:05:00 GMT</pubDate><guid>http://www.cppblog.com/fenglin/articles/129108.html</guid><wfw:comment>http://www.cppblog.com/fenglin/comments/129108.html</wfw:comment><comments>http://www.cppblog.com/fenglin/articles/129108.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fenglin/comments/commentRss/129108.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fenglin/services/trackbacks/129108.html</trackback:ping><description><![CDATA[Struts2中的路径问题是根据action的路径而不是jsp路径来确定，所以<span style="COLOR: red">尽量<strong>不要使用相对路径</strong></span>。<br>以下为实例：<br>index.jsp<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img id=Codehighlighter1_2_84_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Open_Text.style.display='none'; Codehighlighter1_2_84_Closed_Image.style.display='inline'; Codehighlighter1_2_84_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2_84_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Closed_Text.style.display='none'; Codehighlighter1_2_84_Open_Image.style.display='inline'; Codehighlighter1_2_84_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2_84_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2_84_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">@&nbsp;page&nbsp;language</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">java</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;contentType</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">text/html;&nbsp;charset=utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;pageEncoding</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"&nbsp;"http://www.w3.org/TR/html4/loose.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta&nbsp;</span><span style="COLOR: #ff0000">http-equiv</span><span style="COLOR: #0000ff">="Content-Type"</span><span style="COLOR: #ff0000">&nbsp;content</span><span style="COLOR: #0000ff">="text/html;&nbsp;charset=ISO-8859-1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Path</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="path/path.action"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">路径问题说明</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div>
path.jsp<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img id=Codehighlighter1_2_84_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Open_Text.style.display='none'; Codehighlighter1_2_84_Closed_Image.style.display='inline'; Codehighlighter1_2_84_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2_84_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2_84_Closed_Text.style.display='none'; Codehighlighter1_2_84_Open_Image.style.display='inline'; Codehighlighter1_2_84_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2_84_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2_84_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">@&nbsp;page&nbsp;language</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">java</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;contentType</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">text/html;&nbsp;charset=utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;pageEncoding</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">utf-8</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"&nbsp;"http://www.w3.org/TR/html4/loose.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta&nbsp;</span><span style="COLOR: #ff0000">http-equiv</span><span style="COLOR: #0000ff">="Content-Type"</span><span style="COLOR: #ff0000">&nbsp;content</span><span style="COLOR: #0000ff">="text/html;&nbsp;charset=ISO-8859-1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Struts2_Path</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_308_474_Open_Image onclick="this.style.display='none'; Codehighlighter1_308_474_Open_Text.style.display='none'; Codehighlighter1_308_474_Closed_Image.style.display='inline'; Codehighlighter1_308_474_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_308_474_Closed_Image onclick="this.style.display='none'; Codehighlighter1_308_474_Closed_Text.style.display='none'; Codehighlighter1_308_474_Open_Image.style.display='inline'; Codehighlighter1_308_474_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">&lt;%</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_308_474_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_308_474_Open_Text><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #0000ff">String</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;path&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getContextPath();<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #0000ff">String</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;basePath&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">=</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getScheme()&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">://</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getServerName()&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">:</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;request.getServerPort()<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;path&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">+</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">&nbsp;</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">/</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">"</span><span style="BACKGROUND-COLOR: #f5f5f5; COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></span><span style="BACKGROUND-COLOR: #ffff00; COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">base&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="&lt;%=basePath%&gt;"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;使用base标签指定本页面所有链接的参照路径&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">Struts2中的路径问题是根据action的路径而不是jsp路径来确定，所以尽量不要使用相对路径。<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="index.jsp"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">index.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">虽然可以用redirect方式解决，但redirect方式并非必要。<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">解决办法非常简单，统一使用绝对路径。（在jsp中用request.getContextPath方式来获取到webapp的路径）<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">或者使用myeclipse经常用的，指定basePath<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div>
PathAction.java<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000">&nbsp;com.bebig.struts2.path.action;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000">&nbsp;com.opensymphony.xwork2.ActionSupport;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img id=Codehighlighter1_133_198_Open_Image onclick="this.style.display='none'; Codehighlighter1_133_198_Open_Text.style.display='none'; Codehighlighter1_133_198_Closed_Image.style.display='inline'; Codehighlighter1_133_198_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_133_198_Closed_Image onclick="this.style.display='none'; Codehighlighter1_133_198_Closed_Text.style.display='none'; Codehighlighter1_133_198_Open_Image.style.display='inline'; Codehighlighter1_133_198_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;PathAction&nbsp;</span><span style="COLOR: #0000ff">extends</span><span style="COLOR: #000000">&nbsp;ActionSupport&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_133_198_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_133_198_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;@Override<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;String&nbsp;execute()<br><img id=Codehighlighter1_174_196_Open_Image onclick="this.style.display='none'; Codehighlighter1_174_196_Open_Text.style.display='none'; Codehighlighter1_174_196_Closed_Image.style.display='inline'; Codehighlighter1_174_196_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_174_196_Closed_Image onclick="this.style.display='none'; Codehighlighter1_174_196_Closed_Text.style.display='none'; Codehighlighter1_174_196_Open_Image.style.display='inline'; Codehighlighter1_174_196_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_174_196_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_174_196_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">path</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
struts.xml<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"&nbsp;</span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;struts&nbsp;PUBLIC<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"-//Apache&nbsp;Software&nbsp;Foundation//DTD&nbsp;Struts&nbsp;Configuration&nbsp;2.0//EN"<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;"http://struts.apache.org/dtds/struts-2.0.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;Add&nbsp;packages&nbsp;here&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">constant&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="struts.devMode"</span><span style="COLOR: #ff0000">&nbsp;value</span><span style="COLOR: #0000ff">="true"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="front"</span><span style="COLOR: #ff0000">&nbsp;namespace</span><span style="COLOR: #0000ff">="/path"</span><span style="COLOR: #ff0000">&nbsp;extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="path"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="com.bebig.struts2.path.action.PathAction"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result&nbsp;</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="path"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/path.jsp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
web.xml<br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"</span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">web-app&nbsp;</span><span style="COLOR: #ff0000">xmlns:xsi</span><span style="COLOR: #0000ff">="http://www.w3.org/2001/XMLSchema-instance"</span><span style="COLOR: #ff0000">&nbsp;xmlns</span><span style="COLOR: #0000ff">="http://java.sun.com/xml/ns/javaee"</span><span style="COLOR: #ff0000">&nbsp;xmlns:web</span><span style="COLOR: #0000ff">="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"</span><span style="COLOR: #ff0000">&nbsp;xsi:schemaLocation</span><span style="COLOR: #0000ff">="http://java.sun.com/xml/ns/javaee&nbsp;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"</span><span style="COLOR: #ff0000">&nbsp;version</span><span style="COLOR: #0000ff">="2.5"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">struts2</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">struts2</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/*</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">welcome-file-list</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">welcome-file</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">index.html</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">welcome-file</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">welcome-file</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">index.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">welcome-file</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">welcome-file-list</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">web-app</span><span style="COLOR: #0000ff">&gt;</span></div>
<img src ="http://www.cppblog.com/fenglin/aggbug/129108.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fenglin/" target="_blank">风林</a> 2010-10-09 00:05 <a href="http://www.cppblog.com/fenglin/articles/129108.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>