﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-冉翔的技术专栏-文章分类-07.Open Source</title><link>http://www.blogjava.net/ranxiang/category/4387.html</link><description>关注于J2SE，J2EE以及开源方面的技术。</description><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 15:58:01 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 15:58:01 GMT</pubDate><ttl>60</ttl><item><title>Appfuse关于日志记录重复的一个bug</title><link>http://www.blogjava.net/ranxiang/articles/35124.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Mon, 13 Mar 2006 12:39:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/35124.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/35124.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/35124.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/35124.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/35124.html</trackback:ping><description><![CDATA[<p>如果你在一个父类为BaseAction的子类中抛出异常<br><br>那么控制台会把这个异常打印两次，实际上显示一次就够了。</p><br><p>查看源码。得知。</p><br>如果你在BaseAction的ActionForward xxx()中有异常抛出<br><br>那么会执行到ActionExceptionHandler这个类的execute()方法。<br><br>这个方法有两行代码值得注意<br><br>super.execute()<br><br>log.Exception()<br><br><br>log.Exception()方法就是打印[ERROR]日志的。<br><br>那么为什么会出现两次呢。<br><br>答案就在super.execute()&nbsp; 这个类是继承了Struts的ExceptionHandler类。<br><br>而在ExceptionHandler类中的execute()方法中，已经调用了 log.Exception()<br><br><br>所以导致会出现打印两次error的情况。<br><br>解决办法是把ActionExceptionHandler.execute()方法中的调用log.Exception()的这句注释掉。那么就正常了。<br><br><br><br>PS：发了一封邮件给Matt(Appfuse's author)很快得到回信，然后就把这个bug提交给了Appfuse的JIRA。<br><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://issues.appfuse.org/browse/APF-296" target="_blank">http://issues.appfuse.org<wbr>/browse/APF-296</a><br><br>谢谢 <a href="http://blog.donews.com/liusong1111/">liusong1111</a>，解决办法是他听了我的描述之后告诉我的：）<br><img src ="http://www.blogjava.net/ranxiang/aggbug/35124.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2006-03-13 20:39 <a href="http://www.blogjava.net/ranxiang/articles/35124.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Hibernate]《深入浅出Hibernate》读书笔记1</title><link>http://www.blogjava.net/ranxiang/articles/23183.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Fri, 09 Dec 2005 09:31:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/23183.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/23183.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/23183.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/23183.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/23183.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">《深入浅出<SPAN lang=EN-US>Hibernate</SPAN>》读书笔记<SPAN lang=EN-US>1<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">作者：冉翔<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN style="FONT-SIZE: 15pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">第一部分 持久层</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 15pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 37.5pt; TEXT-INDENT: -37.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN style="FONT-SIZE: 15pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">第一章</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN style="FONT-SIZE: 15pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">面向应用的持久层设计</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">现今的应用系统设计中，<SPAN lang=EN-US>MVC</SPAN>（<SPAN lang=EN-US>Model-View-Control</SPAN>）作为主流系统架构模式之一，贯穿了整个设计流程。<SPAN lang=EN-US>MVC</SPAN>中的<SPAN lang=EN-US>M</SPAN>，也就是所谓的<SPAN lang=EN-US>Model</SPAN>，则可以说是与业务逻辑和数据逻辑关联最为紧密地部分。而持久层作为<SPAN lang=EN-US>Model</SPAN>层面中的主要组成，其设计的优劣必对系统的整体表现产生至关重要的影响。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-INDENT: -19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.1</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt"> </SPAN><B><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">持久层概述</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">持久（<SPAN lang=EN-US>Persistence</SPAN>）。简单来讲，也就是把数据保存到可掉电式存储设备中供之后使用。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">所谓“持久层”，也就是在系统逻辑层面上，专注于实现数据持久化的一个相对独立的领域（<SPAN lang=EN-US>Domain</SPAN>）。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-INDENT: -19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt"> </SPAN><B><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">持久层设计</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2.1</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">持久层设计与解耦合</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2.1.1</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">何谓耦合，何谓解耦合</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">何谓耦合？通俗地讲，就是事物之间的相互关联关系。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">何谓解耦合？即采用一些手段降低关联的紧密程度。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2.1.2</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">解耦合思想的自然演讲</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2.1.3</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">解耦合设计的目标</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·应用层解耦合――应用逻辑与数据逻辑相分离<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·资源曾解耦合――逻辑结构与物力结构相分离<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2.1.4</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">持久层解耦合与<SPAN lang=EN-US>DAO</SPAN>模式</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">DAO</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">（<SPAN lang=EN-US>Data Access Object</SPAN>）模式实际上是两个模式的组合。即<SPAN lang=EN-US>Data Accessor</SPAN>模式与<SPAN lang=EN-US>Active Domain Object</SPAN>模式，其中<SPAN lang=EN-US>Data Accessor</SPAN>模式实现了数据访问和业务逻辑的分离，而<SPAN lang=EN-US>Active Domain Object</SPAN>模式实现了业务数据的对象化封装，一般我们将这两个模式组合使用。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">DAO</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">模式通过对业务层提供数据抽象层接口，实现了以下目标：<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">数据存储逻辑的分离<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">2.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">数据访问底层实现的分离<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">3.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">资源管理和调度的分离<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">4.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">数据抽象<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 94.5pt; TEXT-INDENT: -73.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Data Accessor</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">：即将数据访问的实现机制加以封装，与数据的使用代码相分离，从外部来看，<SPAN lang=EN-US>Data Accessor</SPAN>提供了黑盒式的数据存取接口。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 94.5pt; TEXT-INDENT: -73.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Domain Object</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">：则提供了对面向领域内对象的封装。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 94.5pt; TEXT-INDENT: -73.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 94.5pt; TEXT-INDENT: -73.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Data Accessor Object</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">（<SPAN lang=EN-US>DAO</SPAN>）<SPAN lang=EN-US>= Data + Accessor + domain Object<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 94.5pt; TEXT-INDENT: -73.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 17.95pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">所谓<SPAN lang=EN-US>Domain Object</SPAN>，简单来讲就是对领域内（<SPAN lang=EN-US>Domain</SPAN>）设计的各个数据对象，反映到代码，就是一个拥有相关属性的<SPAN lang=EN-US>getter</SPAN>，<SPAN lang=EN-US>setter</SPAN>方法的<SPAN lang=EN-US>Java Class</SPAN>（<SPAN lang=EN-US>Java Bean</SPAN>）。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2.1.5</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">DAO</SPAN></B><B><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">模式的进一步改良</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US> Factory</SPAN>模式的引入<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US> Proxy</SPAN>模式的引入<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2.2</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">持久层设计与资源管理模式</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2.2.1</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Connection Pool</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">数据库连接池的基本原理是在内部对象池中维护一定数量的数据库连接，并对外暴露数据库连接获取和返回方法。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">数据库连接池技术带来下面的优势：<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 51pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">．</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">资源重用<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 51pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">2</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">．</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">更快的系统响应速度<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 51pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">3</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">．</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">新的资源分配手段<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 51pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">4</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">．</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">统一的连接管理，避免数据库连接泄漏<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US>Decorator</SPAN>模式<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp; Decorator</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">模式的主要目的是利用一个对象，透明地为另一个对象添加新的功能。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">简单来讲，就是通过一个<SPAN lang=EN-US>Decorator</SPAN>对原有对象进行封装，同时实现与原有对象相同的接口，从而得到一个基于原有对象的，对既有接口的增强性实现。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US>Dynamic Proxy</SPAN>模式<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">严格来讲，<SPAN lang=EN-US>Dynamic Proxy</SPAN>本身并非一种模式，只能算是<SPAN lang=EN-US>Proxy</SPAN>模式的一种动态实现方式。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·他山之石<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US>Apache Jakarta Commons DBCP<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US>Proxool<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.2.2.2</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Statement Pool</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-INDENT: -19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.3</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt"> </SPAN><B><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">持久层设计与<SPAN lang=EN-US>ORM</SPAN></SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.3.1</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">ORM</SPAN></B><B><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">概述</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp; ORM – Object/Relation Mapper</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">：对象－关系型数据映射组件。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp; O/R Mapping</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">描述的是一种设计思想或者实现机制，而<SPAN lang=EN-US>O/R Mapper</SPAN>一般指根据<SPAN lang=EN-US>O/R</SPAN>原理设计的持久化框架，其中包含了除<SPAN lang=EN-US>O/R</SPAN>本身之外的更多内容，如<SPAN lang=EN-US>SQL</SPAN>自生成，事务管理，<SPAN lang=EN-US>Cache</SPAN>管理等。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.3.2</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">持久层实现类型</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">· 混杂模式<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">这种模式的优点在于开发的迅速便捷。对于原型系统或者小型应用而言显得别具意义。但基于这种模式开发的系统，其维护性和扩展性较差，对象属性，数据库结构的变动都将直接导致业务逻辑代码的修改。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">· 基于<SPAN lang=EN-US>Data Class</SPAN>的持久层实现模式<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp; DAO</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">模式就是这种模式的一种典型实现。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">在这种模式中，我们实现了业务逻辑与此曾数据结构之间的分离。<SPAN lang=EN-US>Data Class</SPAN>作为一个相对独立的逻辑层次。较为清晰的体现了所谓持久层的概念。底层关系数据的结构变化，可以较好地屏蔽在数据类这个层次。从而避免对上层的业务逻辑造成影响。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">缺点：随着设计层次的增多，编码量的增加相当可观。相对地一种混杂模式而言，系统结构上得到较大提升的同时，项目设计和开发成本也相应增高。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">· 基于现有持久层框架的实现模式<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">这种模式是第二种模式的眼神。<SPAN lang=EN-US>Data Class</SPAN>所包含的<SPAN lang=EN-US>Data Accessor</SPAN>和<SPAN lang=EN-US>Domain Class</SPAN>数量并没有减少。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp; </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">只是把其中最为繁琐的工作――基于<SPAN lang=EN-US>JDBC</SPAN>的<SPAN lang=EN-US>OR</SPAN>映射工作，交给第三方组建完成。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp; Data Accessor</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">中的繁琐编码工作因此得到了空前简化，而与此同时，伴随持久层框架而来的辅助工具也大大减轻了<SPAN lang=EN-US>Domain Class</SPAN>的编码负担。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-INDENT: -19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.4</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt"> </SPAN><B><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">持久层框架概述</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">一个成熟的持久化框架能为我们作些什么？<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.55pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">· 减少乏味的代码<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.55pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">· 更加面向对象的设计<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.55pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">· 更好的性能<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.55pt; TEXT-INDENT: 10.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">· 更好的移植性<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-INDENT: -19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.5</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 7pt; mso-font-kerning: 0pt"> </SPAN><B><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">主流持久层框架综述</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US> Apache OJB<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US> Hibernate<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US> iBatis<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 19.5pt; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">·<SPAN lang=EN-US> TopLink</SPAN>（是<SPAN lang=EN-US>Oracle</SPAN>的商业产品）<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P><img src ="http://www.blogjava.net/ranxiang/aggbug/23183.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-12-09 17:31 <a href="http://www.blogjava.net/ranxiang/articles/23183.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]Struts Token</title><link>http://www.blogjava.net/ranxiang/articles/20772.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Mon, 21 Nov 2005 07:12:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/20772.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/20772.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/20772.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/20772.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/20772.html</trackback:ping><description><![CDATA[<H1 style="MARGIN: 17pt 0cm 16.5pt"><SPAN lang=EN-US>Struts Token </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</SPAN></H1>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>1,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">先在一个</SPAN><SPAN lang=EN-US>Action</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，调用</SPAN><SPAN lang=EN-US>saveToken(HttpServletRequest request)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法。然后转向带有表单的</SPAN><SPAN lang=EN-US>JSP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，在</SPAN><SPAN lang=EN-US>JSP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面提交表单给一个</SPAN><SPAN lang=EN-US>Action</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，再这个</SPAN><SPAN lang=EN-US>Action</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中进行是否为重复提交的判断。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 2"></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Codehighlighter1_47_166_Open_Image onclick="this.style.display='none'; Codehighlighter1_47_166_Open_Text.style.display='none'; Codehighlighter1_47_166_Closed_Image.style.display='inline'; Codehighlighter1_47_166_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_47_166_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_47_166_Closed_Text.style.display='none'; Codehighlighter1_47_166_Open_Image.style.display='inline'; Codehighlighter1_47_166_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(isTokenValid(request,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">))&nbsp;</SPAN><SPAN id=Codehighlighter1_47_166_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_47_166_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&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: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;未重复提交时，正确的时候应该做的事情</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;mapping.findForward(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">success</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_173_314_Open_Image onclick="this.style.display='none'; Codehighlighter1_173_314_Open_Text.style.display='none'; Codehighlighter1_173_314_Closed_Image.style.display='inline'; Codehighlighter1_173_314_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_173_314_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_173_314_Closed_Text.style.display='none'; Codehighlighter1_173_314_Open_Image.style.display='inline'; Codehighlighter1_173_314_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 id=Codehighlighter1_173_314_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_173_314_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;重复提交时，需要做的事情</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;saveToken(request);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;mapping.findForward(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">error</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<H1 style="MARGIN: 17pt 0cm 16.5pt"><SPAN lang=EN-US>Struts Token </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">机制：</SPAN></H1>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">1，<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">由第一个</SPAN><SPAN lang=EN-US>Action</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">调用</SPAN><SPAN lang=EN-US>saveToken(HttpServletRequest request)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，这个方法内部实现如下：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Codehighlighter1_57_95_Open_Image onclick="this.style.display='none'; Codehighlighter1_57_95_Open_Text.style.display='none'; Codehighlighter1_57_95_Closed_Image.style.display='inline'; Codehighlighter1_57_95_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_57_95_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_57_95_Closed_Text.style.display='none'; Codehighlighter1_57_95_Open_Image.style.display='inline'; Codehighlighter1_57_95_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">protected</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;saveToken(HttpServletRequest&nbsp;request)&nbsp;</SPAN><SPAN id=Codehighlighter1_57_95_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_57_95_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;token.saveToken(request);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>token.saveToken(request);</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个方法的实现如下：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Codehighlighter1_67_288_Open_Image onclick="this.style.display='none'; Codehighlighter1_67_288_Open_Text.style.display='none'; Codehighlighter1_67_288_Closed_Image.style.display='inline'; Codehighlighter1_67_288_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_67_288_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_67_288_Closed_Text.style.display='none'; Codehighlighter1_67_288_Open_Image.style.display='inline'; Codehighlighter1_67_288_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">synchronized</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;saveToken(HttpServletRequest&nbsp;request)&nbsp;</SPAN><SPAN id=Codehighlighter1_67_288_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_67_288_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpSession&nbsp;session&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;request.getSession();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;token&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;generateToken(request);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_201_285_Open_Image onclick="this.style.display='none'; Codehighlighter1_201_285_Open_Text.style.display='none'; Codehighlighter1_201_285_Closed_Image.style.display='inline'; Codehighlighter1_201_285_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_201_285_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_201_285_Closed_Text.style.display='none'; Codehighlighter1_201_285_Open_Image.style.display='inline'; Codehighlighter1_201_285_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(token&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN id=Codehighlighter1_201_285_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_201_285_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;session.setAttribute(Globals.TRANSACTION_TOKEN_KEY,&nbsp;token);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></SPAN></SPAN><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个方法调用</SPAN><SPAN lang=EN-US>generateToken</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法实现如下：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Codehighlighter1_67_288_Open_Image onclick="this.style.display='none'; Codehighlighter1_67_288_Open_Text.style.display='none'; Codehighlighter1_67_288_Closed_Image.style.display='inline'; Codehighlighter1_67_288_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_67_288_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_67_288_Closed_Text.style.display='none'; Codehighlighter1_67_288_Open_Image.style.display='inline'; Codehighlighter1_67_288_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">synchronized</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;saveToken(HttpServletRequest&nbsp;request)&nbsp;</SPAN><SPAN id=Codehighlighter1_67_288_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_67_288_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpSession&nbsp;session&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;request.getSession();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;token&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;generateToken(request);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_201_285_Open_Image onclick="this.style.display='none'; Codehighlighter1_201_285_Open_Text.style.display='none'; Codehighlighter1_201_285_Closed_Image.style.display='inline'; Codehighlighter1_201_285_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_201_285_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_201_285_Closed_Text.style.display='none'; Codehighlighter1_201_285_Open_Image.style.display='inline'; Codehighlighter1_201_285_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(token&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN id=Codehighlighter1_201_285_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_201_285_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;session.setAttribute(Globals.TRANSACTION_TOKEN_KEY,&nbsp;token);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN lang=EN-US>generateToken</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">完毕后，将得到的唯一值</SPAN><SPAN lang=EN-US>setAttribute</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">到</SPAN><SPAN lang=EN-US>session</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;session.setAttribute(Globals.TRANSACTION_TOKEN_KEY,&nbsp;token);</SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></SPAN></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN lang=EN-US>Globals.TRANSACTION_TOKEN_KEY</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的值是：</SPAN><SPAN lang=EN-US>” org.apache.struts.action.TOKEN”</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后跳转到</SPAN><SPAN lang=EN-US>JSP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2，<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US>JSP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面的</SPAN><SPAN lang=EN-US>Struts</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">自定义标签</SPAN><SPAN lang=EN-US> &lt;html:form&gt;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的标签类：</SPAN><SPAN lang=EN-US>org.apache.struts.taglib.html. FormTag</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个类的</SPAN><SPAN lang=EN-US>doStartTag()</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法会调用本类的</SPAN><SPAN lang=EN-US>renderToken()</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Codehighlighter1_35_796_Open_Image onclick="this.style.display='none'; Codehighlighter1_35_796_Open_Text.style.display='none'; Codehighlighter1_35_796_Closed_Image.style.display='inline'; Codehighlighter1_35_796_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_35_796_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_35_796_Closed_Text.style.display='none'; Codehighlighter1_35_796_Open_Image.style.display='inline'; Codehighlighter1_35_796_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">protected</SPAN><SPAN style="COLOR: #000000">&nbsp;String&nbsp;renderToken()&nbsp;</SPAN><SPAN id=Codehighlighter1_35_796_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_35_796_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;StringBuffer&nbsp;results&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;StringBuffer();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpSession&nbsp;session&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;pageContext.getSession();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_179_754_Open_Image onclick="this.style.display='none'; Codehighlighter1_179_754_Open_Text.style.display='none'; Codehighlighter1_179_754_Closed_Image.style.display='inline'; Codehighlighter1_179_754_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_179_754_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_179_754_Closed_Text.style.display='none'; Codehighlighter1_179_754_Open_Image.style.display='inline'; Codehighlighter1_179_754_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(session&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN id=Codehighlighter1_179_754_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_179_754_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;token&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(String)&nbsp;session.getAttribute(Globals.TRANSACTION_TOKEN_KEY);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_338_743_Open_Image onclick="this.style.display='none'; Codehighlighter1_338_743_Open_Text.style.display='none'; Codehighlighter1_338_743_Closed_Image.style.display='inline'; Codehighlighter1_338_743_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_338_743_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_338_743_Closed_Text.style.display='none'; Codehighlighter1_338_743_Open_Image.style.display='inline'; Codehighlighter1_338_743_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(token&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN id=Codehighlighter1_338_743_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_338_743_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.append(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&lt;input&nbsp;type=\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">hidden\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;name=\</SPAN><SPAN style="COLOR: #000000">""</SPAN><SPAN style="COLOR: #000000">);</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.append(Constants.TOKEN_KEY);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.append(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;value</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">\</SPAN><SPAN style="COLOR: #000000">""</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.append(token);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_591_657_Open_Image onclick="this.style.display='none'; Codehighlighter1_591_657_Open_Text.style.display='none'; Codehighlighter1_591_657_Closed_Image.style.display='inline'; Codehighlighter1_591_657_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_591_657_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_591_657_Closed_Text.style.display='none'; Codehighlighter1_591_657_Open_Image.style.display='inline'; Codehighlighter1_591_657_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.isXhtml())&nbsp;</SPAN><SPAN id=Codehighlighter1_591_657_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_591_657_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.append(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">/&gt;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_664_728_Open_Image onclick="this.style.display='none'; Codehighlighter1_664_728_Open_Text.style.display='none'; Codehighlighter1_664_728_Closed_Image.style.display='inline'; Codehighlighter1_664_728_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_664_728_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_664_728_Closed_Text.style.display='none'; Codehighlighter1_664_728_Open_Image.style.display='inline'; Codehighlighter1_664_728_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 id=Codehighlighter1_664_728_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_664_728_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.append(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;results.toString();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这样子会生成类似于</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">&nbsp;</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">input&nbsp;</SPAN><SPAN style="COLOR: #ff0000">type</SPAN><SPAN style="COLOR: #0000ff">="hidden"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;name</SPAN><SPAN style="COLOR: #0000ff">="org.apache.struts.taglib.html.TOKEN"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value</SPAN><SPAN style="COLOR: #0000ff">="6aa35341f25184fd996c4c918255c3ae"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></SPAN></I>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-style: italic">的隐藏标签。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-style: italic">然后提交到一个</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic">Action</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-style: italic">中，在</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic">Action</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-style: italic">中用</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic">isTokenValid()</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-style: italic">方法进行比较</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic">session</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-style: italic">中</SPAN><SPAN lang=EN-US>” org.apache.struts.action.TOKEN”</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的这个</SPAN><SPAN lang=EN-US>key</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所对应的值和提交来的</SPAN><SPAN lang=EN-US>request</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的</SPAN><SPAN lang=EN-US>” org.apache.struts.action.TOKEN”</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的这个</SPAN><SPAN lang=EN-US>value</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是否一致。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-style: italic">如果为</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic">true</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-style: italic">，那么证明可以提交。如果为</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic">false</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-style: italic">，证明已经重复，不允许提交。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-bidi-font-style: italic"><o:p></o:p></SPAN></P><img src ="http://www.blogjava.net/ranxiang/aggbug/20772.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-21 15:12 <a href="http://www.blogjava.net/ranxiang/articles/20772.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]Struts应用的国际化</title><link>http://www.blogjava.net/ranxiang/articles/17984.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 08:58:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17984.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17984.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17984.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17984.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17984.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Struts应用的国际化万维网（World Wide Web）的迅猛发展推动了跨国业务的发展，它成为一种在全世界范围内发布产品信息、吸引客户的有效手段。为了使企业Web应用能支持全球客户，软件开发者应该开发出支持多国语言、国际化的Web应用。&nbsp;1 本地化与国际化的概念国际化（简称为I18N）指的是软件设计阶段，就应该使软件具有支持多种语言和...&nbsp;&nbsp;<a href='http://www.blogjava.net/ranxiang/articles/17984.html'>阅读全文</a><img src ="http://www.blogjava.net/ranxiang/aggbug/17984.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 16:58 <a href="http://www.blogjava.net/ranxiang/articles/17984.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]扩展Struts框架</title><link>http://www.blogjava.net/ranxiang/articles/17983.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 08:55:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17983.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17983.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17983.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17983.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17983.html</trackback:ping><description><![CDATA[<p class="MsoNormal"><b style=""><span style="font-size: 14pt; font-family: 新宋体;">扩展<span lang="EN-US">Struts</span>框架<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="text-indent: 21.75pt;" class="MsoNormal"><span style="font-family: 新宋体;">一个好的软件框架应该具备可扩展特性。在<span lang="EN-US">Struts</span>框架中提供了许多可扩展之处，不放将其称为可扩展点（<span lang="EN-US">Extension Point</span>）。以下是<span lang="EN-US">Struts</span>的扩展点：<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="text-indent: 21.75pt;" class="MsoNormal"><span style="font-family: 新宋体;">· 一般性扩展点：<span lang="EN-US">Struts</span>插件（<span lang="EN-US">PlugIn</span>）、扩展<span lang="EN-US">Struts</span>配置类。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="text-indent: 21.75pt;" class="MsoNormal"><span style="font-family: 新宋体;">· 控制器的扩展点：扩展<span lang="EN-US">ActionServlet</span>类、<span lang="EN-US">RequestProcessor</span>类和<span lang="EN-US">Action</span>类。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="text-indent: 21.75pt;" class="MsoNormal"><span style="font-family: 新宋体;">· 视图的扩展点：扩展<span lang="EN-US">Struts</span>客户化标签。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="text-indent: 21.75pt;" class="MsoNormal"><span style="font-family: 新宋体;">· 模型的扩展点：扩展<span lang="EN-US">SessionContainer</span>类和<span lang="EN-US">ApplicationContainer</span>类。<span lang="EN-US"><o:p></o:p></span></span></p>


<p class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p style="margin-left: 18pt; text-indent: -18pt;" class="MsoNormal"><!--[if !supportLists]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;" lang="EN-US"><span style="">1.<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;
</span></span></span></b><!--[endif]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;" lang="EN-US">Struts</span></b><b style=""><span style="font-size: 12pt; font-family: 新宋体;">插件（<span lang="EN-US">PlugIn</span>）<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="margin-left: 17.95pt; text-indent: 21pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">Struts1.1</span><span style="font-family: 新宋体;">框架提供了动态插入和加载组件的功能，这种组件被成为<span lang="EN-US">Struts</span>插件。<span lang="EN-US">Struts</span>插件实际上就是一个<span lang="EN-US">Java</span>类，它在<span lang="EN-US">Struts</span>应用启动时被初始化，在应用关闭时被销毁。任何作为插件的<span lang="EN-US">Java</span>类都应该实现<span lang="EN-US">org.apache.struts.action.PlugIn</span>接口。<span lang="EN-US">PlugIn</span>接口包括两个方法：<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 18pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p style="margin-left: 18pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">public interface PlugIn {<o:p></o:p></span></p>


<p style="margin-left: 18pt; text-indent: 21.75pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">/**<o:p></o:p></span></p>


<p style="margin-left: 39.75pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">* Notification that the
specified application module is being started.<o:p></o:p></span></p>


<p style="margin-left: 39.75pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">*/<o:p></o:p></span></p>


<p style="margin-left: 39.75pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">public void
init(ActionServlet servlet, ApplicationConfig config)<o:p></o:p></span></p>


<p style="margin-left: 39.75pt; text-indent: 21.75pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">throws
ServletException;<o:p></o:p></span></p>


<p class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>/**<o:p></o:p></span></p>


<p style="margin-left: 37.5pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">* Notification that the
application module is being shut down.<o:p></o:p></span></p>


<p style="margin-left: 37.5pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">*/<o:p></o:p></span></p>


<p style="margin-left: 37.5pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">public void destroy();<o:p></o:p></span></p>


<p style="margin-left: 18pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">}<o:p></o:p></span></p>


<p style="margin-left: 18pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p style="margin-left: 17.95pt; text-indent: 21pt;" class="MsoNormal"><span style="font-family: 新宋体;">一个<span lang="EN-US">Struts</span>应用可以包含一个或多个插件。在<span lang="EN-US">Struts</span>应用启动时，<span lang="EN-US">Struts</span>框架调用每个插件类的<span lang="EN-US">init()</span>方法进行初始化。在插件的初始化阶段，可以完成一些初始化操作，如建立数据库连接，或者和远程系统的连接等。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.95pt; text-indent: 21pt;" class="MsoNormal"><span style="font-family: 新宋体;">当应用被关闭时，<span lang="EN-US">Struts</span>框架就会调用每个插件类的<span lang="EN-US">destroy()</span>方法，<span lang="EN-US">destroy()</span>方法可以用来完成释放资源的人物，如关闭数据库连接或远程系统连接等。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.95pt; text-indent: 21pt;" class="MsoNormal"><span style="font-family: 新宋体;">除了创建插件类外，还需要在<span lang="EN-US">Struts</span>配置文件中配置插件，<span lang="EN-US">Struts</span>框架在启动时将根据相关的配置信息来初始化插件。与插件对应的配置元素为<span lang="EN-US">&lt;plug-in&gt;</span>。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.95pt; text-indent: 21pt;" class="MsoNormal"><span style="font-family: 新宋体;">根据<span lang="EN-US">Struts</span>配置文件的<span lang="EN-US">DTD</span>定义，在<span lang="EN-US">Struts</span>配置文件中，<span lang="EN-US">&lt;plug-in&gt;</span>元素必需位于其他配置元素的后面。此外，如果在配置文件中配置了多个插件，<span lang="EN-US">Struts</span>框架将按照它们在配置文件中的先后顺序来一次初始化他们。<span lang="EN-US"><o:p></o:p></span></span></p>


<p class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p style="margin-left: 18pt; text-indent: -18pt;" class="MsoNormal"><!--[if !supportLists]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;" lang="EN-US"><span style="">2.<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;
</span></span></span></b><!--[endif]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;">扩展<span lang="EN-US">Struts</span>的配置类<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="margin-left: 17.95pt; text-indent: 17.95pt;" class="MsoNormal"><span style="font-family: 新宋体;">在<span lang="EN-US">Struts</span>应用启动时，<span lang="EN-US">Struts</span>配置文件中的所有信息都会被读到内存中，这些信息存放在<span lang="EN-US">org.apache.struts.config</span>包的相应配置类的实例中。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.95pt; text-indent: 17.95pt;" class="MsoNormal"><span style="font-family: 新宋体;">多数配置元素都由一个<span lang="EN-US">className</span>属性，这个属性用来设置和配置元素对应的配置类。每个配置元素都有默认配置类，<span lang="EN-US">Struts</span>框架允许对这些莫尔那配置类进行扩展。<span lang="EN-US"><o:p></o:p></span></span></p>


<p class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p style="margin-left: 18pt; text-indent: -18pt;" class="MsoNormal"><!--[if !supportLists]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;" lang="EN-US"><span style="">3.<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;
</span></span></span></b><!--[endif]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;">控制器扩展点<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="margin-left: 17.95pt; text-indent: 17.95pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">Struts</span><span style="font-family: 新宋体;">框架在控制器中提供了许多可扩展之处，允许扩展<span lang="EN-US">ActionServlet</span>、<span lang="EN-US">RequestProcessor</span>和<span lang="EN-US">Action</span>类，来实现各种客户化功能。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt;" class="MsoNormal"><b style=""><span style="font-family: 新宋体;" lang="EN-US">3.1 </span></b><b style=""><span style="font-family: 新宋体;">扩展<span lang="EN-US">ActionServlet</span>类<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;">在<span lang="EN-US">Struts1.1</span>以前的版本中，<span lang="EN-US">Struts</span>应用通常都需要扩展<span lang="EN-US">ActionServlet</span>类，来实现各种定制的控制功能。在<span lang="EN-US">Struts1.1</span>中，扩展<span lang="EN-US">ActionServlet</span>类不再是必需的。不过在某些情况下，根据实际情况需要，可不妨扩展<span lang="EN-US">ActionServlet</span>类。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;">当<span lang="EN-US">Struts</span>应用启动时会加载<span lang="EN-US">ActionServlet</span>类并调用它的<span lang="EN-US">init()</span>方法，来对<span lang="EN-US">Struts</span>框架进行初始化。如果需要修改<span lang="EN-US">Struts</span>框架的初始化行为，可以创建一个<span lang="EN-US">org.apache.struts.action.ActionServlet</span>类的子类，然后覆盖它的<span lang="EN-US">init()</span>方法。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;">接下来，应该在<span lang="EN-US">web.xml</span>文件中对自定义的<span lang="EN-US">ActionServlet</span>进行配置。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;">在<span lang="EN-US">Struts1.1</span>中，预处理<span lang="EN-US">HTTP</span>请求的具体操作由<span lang="EN-US">RequestProcessor</span>类来完成。因此，如果需要对预处理<span lang="EN-US">HTTP</span>请求的方式进行客户化，可以扩展<span lang="EN-US">RequestProcessor</span>类。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p style="margin-left: 17.85pt;" class="MsoNormal"><b style=""><span style="font-family: 新宋体;" lang="EN-US">3.2 </span></b><b style=""><span style="font-family: 新宋体;">扩展<span lang="EN-US">RequestProcessor</span>类<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;">如果扩展了<span lang="EN-US">RequestProcessor</span>类，应该在<span lang="EN-US">Struts</span>配置文件中通过<span lang="EN-US">&lt;controller&gt;</span>元素对自定义的<span lang="EN-US">RequestProcessor</span>类进行配置。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">&lt;controller&gt;</span><span style="font-family: 新宋体;">元素的<span lang="EN-US">processorClass</span>属性用来指定使用的<span lang="EN-US">RequestProcessor</span>类。<span lang="EN-US">Struts</span>框架在启动时会创建这个<span lang="EN-US">RequestProcessor</span>类的实例，并利用它来处理所有的<span lang="EN-US">HTTP</span>请求。由于每个子应用模块都有各自的配置文件，因此可以为每个子应用模块配置不同的<span lang="EN-US">RequestProcessor</span>类。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">RequestProcessor</span><span style="font-family: 新宋体;">类的一个扩展点为<span lang="EN-US">processPreprocess()</span>方法。在<span lang="EN-US">RequestProcessor</span>基类中，该方法不执行任何操作，志军诶返回<span lang="EN-US">true</span>。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">RequestProcessor</span><span style="font-family: 新宋体;">类在<span lang="EN-US">process()</span>方法中处理请求，<span lang="EN-US">Process()</span>方法在调用<span lang="EN-US">Action</span>的<span lang="EN-US">execute()</span>方法之前，就会调用<span lang="EN-US">processPreprocess()</span>方法，如果<span lang="EN-US">processPreprocess()</span>方法返回<span lang="EN-US">true</span>，则表示继续按正常的流程处理请求。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;">在自定义的<span lang="EN-US">RequestProcessor</span>类中，可以覆盖<span lang="EN-US">processPreprocess()</span>方法来执行特定的逻辑。如果在某些条件下希望终止处理请求，只需让<span lang="EN-US">processPreprocess()</span>方法<span lang="EN-US">false</span>即可。在这种情况下，仍需要以编程的方式来决定如何转发或重定向请求。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">Servlet 2.3 API</span><span style="font-family: 新宋体;">提供了<span lang="EN-US">Servlet</span>过滤器，它可以实现和<span lang="EN-US">processPreprocess()</span>方法相同的功能。<span lang="EN-US">Servlet</span>过滤器也可以用来执行客户化的预处理请求操作，<span lang="EN-US">Web</span>容器先调用<span lang="EN-US">Servlet</span>过滤器，再把请求转发给<span lang="EN-US">Struts</span>控制器。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;">与扩展<span lang="EN-US">RequestProcessor</span>类相比，通过<span lang="EN-US">Servlet</span>过滤器来预处理请求有两大弱点：<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p style="margin-left: 37.35pt; text-indent: -19.5pt;" class="MsoNormal"><!--[if !supportLists]--><b style=""><span style="font-family: 新宋体;" lang="EN-US"><span style="">3.3<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"> </span></span></span></b><!--[endif]--><b style=""><span style="font-family: 新宋体;">扩展<span lang="EN-US">Action</span>类<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="margin-left: 17.85pt; text-indent: 18.05pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">Struts</span><span style="font-family: 新宋体;">框架的<span lang="EN-US">Action</span>类是最频繁的扩展点。对于具体的<span lang="EN-US">Struts</span>应用，可以先为应用创建一个扩展<span lang="EN-US">Struts Action</span>类的<span lang="EN-US">Action</span>基类，在这个<span lang="EN-US">Action</span>基类中定义应用中所有<span lang="EN-US">Action</span>的一些公共逻辑，它可以作为其他<span lang="EN-US">Action</span>的父类。这种处理方式可以提高代码的可重用性，减少代码的重复。<span lang="EN-US"><o:p></o:p></span></span></p>


<p class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p style="margin-left: 18pt; text-indent: -18pt;" class="MsoNormal"><!--[if !supportLists]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;" lang="EN-US"><span style="">4.<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;
</span></span></span></b><!--[endif]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;">扩展视图组件<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="margin-left: 17.95pt; text-indent: 17.95pt;" class="MsoNormal"><span style="font-family: 新宋体;">一般说来，没有必要扩展视图组件，因为不同的应用有不同的外观和界面，一个应用的<span lang="EN-US">JSP</span>页面不大可能适用于另一个不同的应用。不过，可以扩展<span lang="EN-US">Struts</span>客户化标签，因为标签处理器为常规的<span lang="EN-US">Java</span>类，可以通过定义子类的方式来扩展它们，这些扩展后的客户化标签能够被不同的应用重用。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.95pt; text-indent: 17.95pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">Struts HTML</span><span style="font-family: 新宋体;">标签库中的标签对视图内容的影响最大。因此可以扩展这些标签来创建客户化的应用外观。当扩展了标签后，应该定义存放这些标签的标签库。尽管可以把自定义的标签加入到标准的<span lang="EN-US">Struts</span>标签库中，但是这会使将应用升级到新的<span lang="EN-US">Struts</span>版本变得更加麻烦。所以建议定义单独的标签库，来存放和特定应用相关的客户化标签。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.95pt; text-indent: 17.95pt;" class="MsoNormal"><span style="font-family: 新宋体;">一旦为客户华标签库创建了<span lang="EN-US">TLD</span>文件，并且在<span lang="EN-US">web.xml</span>中注册了标签库，就可以在<span lang="EN-US">JSP</span>文件中方便地使用这些标签了。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 18pt; text-indent: -18pt;" class="MsoNormal"><!--[if !supportLists]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;" lang="EN-US"><span style="">5.<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;
</span></span></span></b><!--[endif]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;">扩展模型组件<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="margin-left: 17.85pt; text-indent: 17.95pt;" class="MsoNormal"><span style="font-family: 新宋体;" lang="EN-US">Struts</span><span style="font-family: 新宋体;">框架本身没有在模型层提供现成的模型组件，因此扩展模型组件不属于<span lang="EN-US">Struts</span>技术。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 18pt; text-indent: -18pt;" class="MsoNormal"><!--[if !supportLists]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;" lang="EN-US"><span style="">6.<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;
</span></span></span></b><!--[endif]--><b style=""><span style="font-size: 12pt; font-family: 新宋体;">小结<span lang="EN-US"><o:p></o:p></span></span></b></p>


<p style="margin-left: 17.85pt; text-indent: 17.95pt;" class="MsoNormal"><span style="font-family: 新宋体;">本篇文档归纳了<span lang="EN-US">Struts</span>框架的所有可扩展点。<span lang="EN-US">Struts</span>框架的可扩展性使开发者可以方便地定制客户化功能，提高应用的灵活性和多各种需求的可适应性。然而，实现更多的功能使要花费更大代价的，应该避免滥用<span lang="EN-US">Struts</span>的可扩展特性。<span lang="EN-US">Struts</span>由核心包加上很多工具包构成。它们已经提供了很多现成的功能。因此不要盲目地扩展<span lang="EN-US">Struts</span>框架，在决定编写扩展代码前，务必先确认<span lang="EN-US">Struts</span>没有提供现成的您需要的功能。否则，重复的功能会导致应用结构的混乱，将来还得花费额外的经历来清除重复功能。<span lang="EN-US"><o:p></o:p></span></span></p>


<p style="margin-left: 17.85pt; text-indent: 17.95pt;" class="MsoNormal"><span style="font-family: 新宋体;">此外，必需考虑扩展后的框架是否会和将来的新的<span lang="EN-US">Struts</span>版本兼容，从<span lang="EN-US">Struts 1.0</span>到<span lang="EN-US">Struts 1.1</span>就发生了很大的改动。在先有的<span lang="EN-US">Struts</span>版本的<span lang="EN-US">API</span>中，如果有的类的方法已经声明将要被废弃，应该尽量不要覆盖这些方法，否则，当采用新的<span lang="EN-US">Struts</span>版本时，就不得不对应用做相应的升级。<span lang="EN-US"><o:p></o:p></span></span></p>

<br>
<br>
阅读材料：《精通Struts：基于MVC的Java Web设计与开发》<br>
<br>
<br>
<br>
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2005年05月19日 2:37 AM<img src ="http://www.blogjava.net/ranxiang/aggbug/17983.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 16:55 <a href="http://www.blogjava.net/ranxiang/articles/17983.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]Struts视图组件</title><link>http://www.blogjava.net/ranxiang/articles/17982.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 08:49:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17982.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17982.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17982.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17982.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17982.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Struts视图组件Struts框架的视图负责为客户提供动态网页内容。Struts视图主要由JSP网页构成，此外，Struts框架还提供了Struts客户化标签和ActionForm Bean，这些组件提供对国际化、接收用户输入的表单数据、表单验证和错误处理等的支持，使开发者可以把更多的经历放在实现业务需求上。&nbsp;1 视图概述视图使模型的外在...&nbsp;&nbsp;<a href='http://www.blogjava.net/ranxiang/articles/17982.html'>阅读全文</a><img src ="http://www.blogjava.net/ranxiang/aggbug/17982.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 16:49 <a href="http://www.blogjava.net/ranxiang/articles/17982.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]Struts 模型组件</title><link>http://www.blogjava.net/ranxiang/articles/17981.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 08:43:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17981.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17981.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17981.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17981.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17981.html</trackback:ping><description><![CDATA[<p class="MsoNormal"><b style=""><span style="font-size: 14pt;" lang="EN-US">Struts </span></b><b style=""><span style="font-size: 14pt; font-family: 宋体;">模型组件</span></b><b style=""><span style="font-size: 14pt;" lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">模型代表应用的业务数据和逻辑。</span><span lang="EN-US">Struts</span><span style="font-family: 宋体;">框架并没有为设计和创建模型组件提供现成的框架。不过，</span><span lang="EN-US">Struts</span><span style="font-family: 宋体;">允许使用其他模型框架来处理应用的业务领域，如</span><span lang="EN-US">EJB(Enterprise JavaBean)</span><span style="font-family: 宋体;">和</span><span lang="EN-US">JDO(Java Data Object)</span><span style="font-family: 宋体;">，以及常规的</span><span lang="EN-US">JavaBean</span><span style="font-family: 宋体;">和</span><span lang="EN-US">ORM(Object-Relation Mapping)</span><span style="font-family: 宋体;">。</span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><b style=""><span style="font-size: 12pt;" lang="EN-US">1 </span></b><b style=""><span style="font-size: 12pt; font-family: 宋体;">模型在</span></b><b style=""><span style="font-size: 12pt;" lang="EN-US">MVC</span></b><b style=""><span style="font-size: 12pt; font-family: 宋体;">中的地位</span></b><b style=""><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">模型是应用中最重要的一部分，它包含了业务实体和业务规则，负责访问和更新持久化数据。应该把所有的模型组件放在系统中的同一个位置，这有利于维护数据的完整性，减少数据冗余，提高可重用性。</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">模型应该和视图以及控制器之间保持独立。在分层的的框架结构中，位于上层的视图和控制器依赖于下层模型的实现，而上层模型不应该依赖于上层的视图和控制器的实现。</span><span lang="EN-US">Struts</span><span style="font-family: 宋体;">应用的各个层次之间的依赖关系：</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal" style="text-indent: 63.75pt;"><span style="font-family: 宋体;">从上到下，依赖关系加强；从下到上，依赖关系减弱。</span></p>


<table class="MsoTableGrid" style="border: medium none ; margin-left: 4cm; border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0">

 <tbody><tr style="">
  <td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 144pt;" valign="top" width="192">
  <p class="MsoNormal"><span style="font-family: 宋体;">视图层</span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 144pt;" valign="top" width="192">
  <p class="MsoNormal"><span style="font-family: 宋体;">控制层</span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 144pt;" valign="top" width="192">
  <p class="MsoNormal"><span style="font-family: 宋体;">模型层</span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 144pt;" valign="top" width="192">
  <p class="MsoNormal"><span style="font-family: 宋体;">持久化层</span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 144pt;" valign="top" width="192">
  <p class="MsoNormal"><span style="font-family: 宋体;">网络层</span></p>
  </td>
 </tr>
</tbody>
</table>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">如果在模型组件中通过</span><span lang="EN-US">Java</span><span style="font-family: 宋体;">的</span><span lang="EN-US">import</span><span style="font-family: 宋体;">语句引入了视图和控制器组件，这就违反了以上原则。下层组件访问上层组件会使应用的维护、重用和扩展变得困难。</span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><b style=""><span style="font-size: 12pt;" lang="EN-US">2 </span></b><b style=""><span style="font-size: 12pt; font-family: 宋体;">模型的概念和类型。</span></b><b style=""><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">在科学和工程技术领域，模型是一个很有用途的概念，它可以用来模拟一个真实的系统。建立模型最主要的目的是帮助理解、描述或模拟真实世界中目标系统的运转机制。</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">在软件开发领域，模型用来表示真实世界的实体。在软件开发的不同阶段，需要为目标系统创建不同类型的模型。在分析阶段，需要创建概念模型。在设计阶段，需要创建设计模型。可以采用面向对象建模语言</span><span lang="EN-US">UML</span><span style="font-family: 宋体;">来描述模型。</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><b style=""><span lang="EN-US">2.1 </span></b><b style=""><span style="font-family: 宋体;">概念模型</span><span lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">在建立模型之前，首先要对问题域进行详细的分析，确定用例，接下来就可以根据用例来创建概念模型。概念模型用来模拟问题域中的真实实体。概念模型描述了每个实体的概念和属性，以及实体之间的关系。但在这个阶段并不描述实体的行为。</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">创建概念模型的目的是帮助更好地理解问题域，识别系统中的实体，这些实体在设计阶段很有可能变成类。</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">概念模型清楚地显示了问题域中的实体。不管是技术人员还是非技术人员都能看得懂概念模型，他们可以很容易地提出概念模型中存在的问题，帮助系统分析人员及早对模型进行修改。在软件设计与开发周期中，模型的变更需求提出得越晚，所耗费的开发成本就越大。</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 0.05pt;"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 0.05pt;"><b style=""><span lang="EN-US">2.2 </span></b><b style=""><span style="font-family: 宋体;">设计模型</span><span lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">概念模型是在软件分析阶段创建的，它帮助开发人员对应的需求获得清晰精确的理解。在软件设计阶段，需要在概念模型的基础上创建设计模型。可以用</span><span lang="EN-US">UML</span><span style="font-family: 宋体;">类框图，活动图以及状态图来描述设计模型。</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">根据</span><span lang="EN-US">UML</span><span style="font-family: 宋体;">语言，类直接存在四种关系。</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span>1
</span><span style="font-family: 宋体;">关联</span><span lang="EN-US">(Association)</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style="font-family: 宋体;">关联指的是类之间的引用关系。</span></p>


<p class="MsoNormal" style="margin-left: 17.85pt; text-indent: 0.1pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span>2 </span><span style="font-family: 宋体;">依赖</span><span lang="EN-US">(Dependency)</span></p>


<p class="MsoNormal" style="margin-left: 17.85pt; text-indent: 0.1pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">依赖指的是类之间的访问关系。</span></p>


<p class="MsoNormal" style="margin-left: 17.85pt; text-indent: 0.1pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span>3 </span><span style="font-family: 宋体;">累积</span><span lang="EN-US">(Aggregation)</span></p>


<p class="MsoNormal" style="margin-left: 17.85pt; text-indent: 0.1pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">累积指的是整体与个体之间的关系，可以把累积看作一种强关联关系。</span></p>


<p class="MsoNormal" style="margin-left: 17.85pt; text-indent: 0.1pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp; </span><span style="">&nbsp;</span>4 </span><span style="font-family: 宋体;">一般化</span><span lang="EN-US">(Generalization)</span></p>


<p class="MsoNormal" style="margin-left: 17.85pt; text-indent: 0.1pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">一般化指的是类之间的继承元素。</span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><b style=""><span style="font-size: 12pt;" lang="EN-US">3 </span></b><b style=""><span style="font-size: 12pt; font-family: 宋体;">业务对象</span></b><b style=""><span style="font-size: 12pt;" lang="EN-US">(BO)<o:p></o:p></span></b></p>


<p class="MsoNormal" style="text-indent: 17.85pt;"><span style="font-family: 宋体;">业务对象，即</span><span lang="EN-US">Business Object(BO)</span><span style="font-family: 宋体;">，是对真实世界的实体的软件抽象。它可以代表业务领域中的人、地点、事物或概念。</span></p>


<p class="MsoNormal"><span lang="EN-US"><span style="">&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">业务对象包括状态和行为。</span></p>


<p class="MsoNormal" style="margin-left: 17.85pt; text-indent: 0.1pt;"><span style="font-family: 宋体;">判断一个类是否可以成为业务对象的一个重要标准，是看这个类是否同时拥有状态和行为。</span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><b style=""><span lang="EN-US">3.1 </span></b><b style=""><span style="font-family: 宋体;">业务对象的特征和类型</span><span lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">如果一个类可以作为业务对象，它应具有以下特征：</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">·</span>
<span style="font-family: 宋体;">包含状态和行为</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">·</span>
<span style="font-family: 宋体;">代表业务领域的人、地点、事物或概念</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">·</span>
<span style="font-family: 宋体;">可以重用</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">业务对象可分为三种类型：</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">·</span>
<span style="font-family: 宋体;">实体业务对象</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">·</span>
<span style="font-family: 宋体;">过程业务对象</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">·</span>
<span style="font-family: 宋体;">事件业务对象</span></p>


<p class="MsoNormal" style="margin-left: 17.9pt; text-indent: -0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style="font-family: 宋体;">实体业务对象要算是最为人们所熟悉的。实体对象可以代表人、地点、事物或概念。通常，可以把业务领域中的名词，例如客户、订单、商品等作为实体业务对象。在</span><span lang="EN-US">J2EE</span><span style="font-family: 宋体;">应用中，这些名词可以作为实体</span><span lang="EN-US">Bean</span><span style="font-family: 宋体;">。对于更普通的</span><span lang="EN-US">Web</span><span style="font-family: 宋体;">应用，这些名词可以作为包含状态和行为的</span><span lang="EN-US">JavaBean</span><span style="font-family: 宋体;">。</span></p>


<p class="MsoNormal" style="margin-left: 17.9pt; text-indent: -0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style="font-family: 宋体;">过程业务对象代表应用种的业务过程或流程，它们通常依赖于实体业务对象。可以把业务领域中的动词。例如客户发出订单、登入应用等作为过程业务对象。在</span><span lang="EN-US">J2EE</span><span style="font-family: 宋体;">应用中，它们通常作为会话</span><span lang="EN-US">Bean</span><span style="font-family: 宋体;">或者消息驱动</span><span lang="EN-US">Bean</span><span style="font-family: 宋体;">。在非</span><span lang="EN-US">J2EE</span><span style="font-family: 宋体;">应用中，他们可作为常规的</span><span lang="EN-US">JavaBean</span><span style="font-family: 宋体;">，具有管理和控制应用的行为。过程业务对象也可以拥有状态，例如在</span><span lang="EN-US">J2EE</span><span style="font-family: 宋体;">应用中，会话</span><span lang="EN-US">Bean</span><span style="font-family: 宋体;">可分为有状态和无状态两种。</span></p>


<p class="MsoNormal" style="margin-left: 17.9pt; text-indent: -0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style="font-family: 宋体;">事件业务对象代表应用中的一些时间（如异常、警告或超时）。这些时间通常由系统中的某种行为处罚。例如，在</span><span lang="EN-US">Java Swing</span><span style="font-family: 宋体;">应用中，当客户按下一个按钮，就会有一个事件业务对象产生，以便通知框架调用相关的时间处理器来处理事件。</span></p>


<p class="MsoNormal" style="margin-left: 17.9pt; text-indent: -0.05pt;"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal" style="margin-left: 17.9pt; text-indent: -0.05pt;"><b style=""><span lang="EN-US">3.2
</span></b><b style=""><span style="font-family: 宋体;">业务对象的重要性</span><span lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="margin-left: 17.9pt; text-indent: -0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">在
应用中使用业务对象有许多好处，最重要的一点就是业务对象提供了通用的术语和概念，不管是技术人员还是非技术人员都可以共享并理解他们。它们可以直观地代
表真实世界中的概念，开发小组的所有成员都能理解他们。如果正对同一个业务领域需要开发出多个应用，那么这些应用可以共享这些业务对象。业务对象的可重用
特性可以提高应用开发速度。减少冗余。</span></p>


<p class="MsoNormal" style="margin-left: 17.9pt; text-indent: -0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">此外，业务对象可以隐藏实现细节，对外只保露接口。例如，如果业务对象的某个方法需要传入</span><span lang="EN-US">java.util.ArrayList</span><span style="font-family: 宋体;">类型的参数，那么应该把参数定义为</span><span lang="EN-US">java.util.List</span><span style="font-family: 宋体;">接口类型。这样，假定这个方法的实现发生改变，用</span><span lang="EN-US">LinkedList</span><span style="font-family: 宋体;">取代</span><span lang="EN-US">ArrayList</span><span style="font-family: 宋体;">来实现原有的功能，这种概念不会对方法调用者造成任何英雄。</span></p>


<p class="MsoNormal" style="margin-left: 17.9pt; text-indent: -0.05pt;"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 宋体;">在充分了解到业务对象在应用中的重要性后，接下来需要关心的问题是，这些业务对象的状态从何而来，当应用中指运行时，这些状态被存放到什么地方。这就涉及到了对象的持久化问题。</span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><b style=""><span style="font-size: 12pt;" lang="EN-US">4 </span></b><b style=""><span style="font-size: 12pt; font-family: 宋体;">业务对象的持久化</span></b><b style=""><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">通常，持久化意味着通过手工或其他方式输入到应用中的数据，能够在应用结束运行后依然存在。即使应用运行结束或者计算机关闭后，这些信息依然存在。不管是大、中或、小型的应用，都需要数据的持久化。</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><b style=""><span lang="EN-US">4.1 </span></b><b style=""><span style="font-family: 宋体;">对业务对象进行持久化的作用。</span><span lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 21.75pt;"><span style="font-family: 宋体;">当应用中的业务对象在内存中创建后，它们不可能永远存在。最后，他们要么从内存中清楚，要么被持久化到数据存储库中。内存无法永久保存数据，因此必需对业务对象进行持久化。否则，如果对象没有被持久化，用户在应用运行时发出的订单信息将在应用结束运行后随之小时。</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 21.75pt;"><span style="font-family: 宋体;">关系型数据库被广泛用来存储数据。关系型数据库中存放的是关系型数据，它是非面向对象的。把业务对象映射到非面向对象的数据库中，存在着阻抗不匹配（</span><span lang="EN-US">impedance mismatch</span><span style="font-family: 宋体;">），因此对象由状态和行为组成，而关系型数据库则由表组成，对象之间的各种关系和关系型数据库中表之间的关系并不一一对象。例如对象之间的继承关系就不能直接映射到关系型数据库中。</span></p>


<p class="MsoNormal" style="text-indent: 18pt;"><b style=""><span lang="EN-US">4.2 </span></b><b style=""><span style="font-family: 宋体;">数据访问对象（</span><span lang="EN-US">DAO</span></b><b style=""><span style="font-family: 宋体;">）设计模式</span><span lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 17.95pt;"><span style="font-family: 宋体;">面向对象的开发方法是当今的主流，但是同时不得不使用关系型数据库，在企业级应用开发的环境中，对象－关系的映射（</span><span lang="EN-US">Object-Relation Mapping</span><span style="font-family: 宋体;">，简称</span><span lang="EN-US">ORM</span><span style="font-family: 宋体;">）是一种耗时的工作。围绕对象－关系的映射和持久化数据的访问，在软件领域中发展起来了一种数据访问对象（</span><span lang="EN-US">Data Access Object</span><span style="font-family: 宋体;">，简称</span><span lang="EN-US">DAO</span><span style="font-family: 宋体;">）设计模式。</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 17.95pt;"><span lang="EN-US">DAO</span><span style="font-family: 宋体;">模式提供了访问关系型数据库系统所需的所有操作的接口，其中包括创建数据库、定义表、字段和索引，建立表间的关系，更新和查询数据库等。</span><span lang="EN-US">DAO</span><span style="font-family: 宋体;">模式将底层数据访问操作与高层业务逻辑分离开，对上层提供面向对象的数据访问接口。在</span><span lang="EN-US">DAO</span><span style="font-family: 宋体;">的实现中，可以采用</span><span lang="EN-US">XML</span><span style="font-family: 宋体;">语言来配置对象和关系型数据之间的映射。</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 17.95pt;"><span style="font-family: 宋体;">对于</span><span lang="EN-US">Java</span><span style="font-family: 宋体;">应用，可以直接通过</span><span lang="EN-US">JDBC</span><span style="font-family: 宋体;">编程来访问数据库。</span><span lang="EN-US">JDBC</span><span style="font-family: 宋体;">可以说是访问持久数据层最原始、最直接的方法。在企业级应用开发中，可以通过</span><span lang="EN-US">JDBC</span><span style="font-family: 宋体;">编程，来开发自己的</span><span lang="EN-US">DAO API</span><span style="font-family: 宋体;">，把数据库访问操作封装起来，供业务曾同一调用。</span></p>


<p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 17.95pt;"><span style="font-family: 宋体;">如果数据模型非常复杂，那么直接通过</span><span lang="EN-US">JDBC</span><span style="font-family: 宋体;">编程来实现持久化框架需要有专业的知识。对于企业应用的开发人员，花费大量时间从头开发自己的持久性框架不是很可行。通常，可以直接采用第三方提供的持久化框架，如</span><span lang="EN-US">ORM</span><span style="font-family: 宋体;">软件产品。许多</span><span lang="EN-US">ORM</span><span style="font-family: 宋体;">框架都采用</span><span lang="EN-US">DAO</span><span style="font-family: 宋体;">设计模式来实现，为模型层提供了访问关系型数据库的</span><span lang="EN-US">API</span><span style="font-family: 宋体;">。</span></p>


<p class="MsoNormal" style="text-indent: 18pt;"><b style=""><span lang="EN-US">4.3 </span></b><b style=""><span style="font-family: 宋体;">常用的</span><span lang="EN-US">ORM</span></b><b style=""><span style="font-family: 宋体;">软件</span><span lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="margin-left: 17.85pt; text-indent: 18pt;"><span style="font-family: 宋体;">有许多</span><span lang="EN-US">ORM</span><span style="font-family: 宋体;">软件可供选择。有些是商业化的，有些是免费的。</span></p>


<table class="MsoTableGrid" style="border: medium none ; border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0">

 <tbody><tr style="">
  <td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">TopLink</span></p>
  </td>
  <td style="border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://otn.oracle.com/products/ias/toplink/content.html">http://otn.oracle.com/products/ias/toplink/content.html</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">Torque</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://jakarta.apache.org/turbine/torque/index.html">http://jakarta.apache.org/turbine/torque/index.html</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">ObjectRelationalBridge</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://db.apache.org/ojb">http://db.apache.org/ojb</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">FronierSuite</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://www.objectfrontier.com/">http://www.objectfrontier.com</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">Castor</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://castor.exolab.org/">http://castor.exolab.org</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">FreeFORM</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://www.chimu.com/projects/form/">http://www.chimu.com/projects/form/</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">Expresso</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://www.jcorporate.com/">http://www.jcorporate.com</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">JRelationalFramework</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://jrf.sourceforge.net/">http://jrf.sourceforge.net</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">VBSF</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://www.objectmatter.com/">http://www.objectmatter.com</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">Jgrinder</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://sourceforget.net/projects/jgrinder/">http://sourceforget.net/projects/jgrinder/</a></span></p>
  </td>
 </tr>
 <tr style="">
  <td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 4cm;" valign="top" width="151">
  <p class="MsoNormal"><span lang="EN-US">Hibernate</span></p>
  </td>
  <td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 312.7pt;" valign="top" width="417">
  <p class="MsoNormal"><span lang="EN-US"><a href="http://www.hibernate.org/">http://www.hibernate.org</a></span></p>
  </td>
 </tr>
</tbody>
</table>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><span lang="EN-US"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style="font-family: 宋体;">不管是使用商业化产品，还是非商业化产品，都应该确保选用的</span><span lang="EN-US">ORM</span><span style="font-family: 宋体;">框架没有“渗透”到应用中，应用的上层组件应该和</span><span lang="EN-US">ORM</span><span style="font-family: 宋体;">框架保持独立。有些</span><span lang="EN-US">ORM</span><span style="font-family: 宋体;">框架要求在业务对象中印入它们的类和接口，这会带来一个问题，如果日后想改用其他的</span><span lang="EN-US">ORM</span><span style="font-family: 宋体;">框架，就必需修改业务对象。</span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><b style=""><span style="font-size: 12pt;" lang="EN-US">5 </span></b><b style=""><span style="font-size: 12pt; font-family: 宋体;">小结</span></b><b style=""><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></b></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">这篇文档介绍了模型的实现方法。</span><span lang="EN-US">Struts</span><span style="font-family: 宋体;">框架并没有在模型层提供线程可用的组件。模型的实现应该和</span><span lang="EN-US">Struts</span><span style="font-family: 宋体;">应用的控制层以及视图层保持独立。</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">模型采用业务对象来描述状态和行为，为了使业务对象持久化，需要把业务对象映射到关系型数据库。</span></p>


<p class="MsoNormal" style="text-indent: 21.75pt;"><span style="font-family: 宋体;">模型向客户程序提供了业务代理接口，业务代理接口直接访问持久化框架，处理实际的业务逻辑。</span><span lang="EN-US">Struts</span><span style="font-family: 宋体;">应用的</span><span lang="EN-US">Action</span><span style="font-family: 宋体;">类可以使用这个业务代理接口，而不必直接和持久化框架交互。这种做法有助于削弱上层</span><span lang="EN-US">Web</span><span style="font-family: 宋体;">应用和持久化框架之间的关系，提高持久化框架的相对独立性。</span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>


<p class="MsoNormal"><span style="font-family: 宋体;">阅读材料：《精通</span><span lang="EN-US">Struts</span><span style="font-family: 宋体;">：基于</span><span lang="EN-US">MVC</span><span style="font-family: 宋体;">的</span><span lang="EN-US">Java Web</span><span style="font-family: 宋体;">设计与开发》<br>
</span></p>
<p class="MsoNormal"><span style="font-family: 宋体;"><br>
</span></p>
<p class="MsoNormal"><span style="font-family: 宋体;"><br>
</span></p>
<p class="MsoNormal"><span style="font-family: 宋体;"><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>2005年05月12日 1:20 AM</p>
<img src ="http://www.blogjava.net/ranxiang/aggbug/17981.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 16:43 <a href="http://www.blogjava.net/ranxiang/articles/17981.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]Struts控制器组件</title><link>http://www.blogjava.net/ranxiang/articles/17979.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 08:23:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17979.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17979.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17979.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17979.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17979.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Struts控制器组件&nbsp;Struts控制器组件负责接受用户请求、更新模型，以及选择合适的视图组件返回给用户。控制器组件有助于将模型层和视图层分离，有了这种分离，就可以在同一个模型的基础上得心应手地开发多种类型的视图。Struts控制器组建主要包括：&nbsp;·ActionServlet组件：充当Struts框架的中央控制器。·...&nbsp;&nbsp;<a href='http://www.blogjava.net/ranxiang/articles/17979.html'>阅读全文</a><img src ="http://www.blogjava.net/ranxiang/aggbug/17979.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 16:23 <a href="http://www.blogjava.net/ranxiang/articles/17979.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]Struts配置文件</title><link>http://www.blogjava.net/ranxiang/articles/17976.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 08:07:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17976.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17976.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17976.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17976.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17976.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Struts配置文件Struts框架在启动时会读入其配置文件，根据它来创建和配置各种Struts组件。Struts配置文件使得开发者可以灵活地组装和配置各个组件，提高了应用软件的可扩展性和灵活性，可以避免硬编码。Struts配置文件是基于XML的。&nbsp;·1。org.apache.struts.config包&nbsp; 在Struts1.1中加入了org.apache.st...&nbsp;&nbsp;<a href='http://www.blogjava.net/ranxiang/articles/17976.html'>阅读全文</a><img src ="http://www.blogjava.net/ranxiang/aggbug/17976.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 16:07 <a href="http://www.blogjava.net/ranxiang/articles/17976.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]为Struts应用配置web.xml文件</title><link>http://www.blogjava.net/ranxiang/articles/17974.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 07:58:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17974.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17974.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17974.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17974.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17974.html</trackback:ping><description><![CDATA[<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><b style=""><span style="font-size: 14pt; font-family: 宋体;">为</span></b><b style=""><span style="font-size: 14pt;" lang="EN-US"><font face="Times New Roman">Struts</font></span></b><b style=""><span style="font-size: 14pt; font-family: 宋体;">应用配置</span></b><b style=""><span style="font-size: 14pt;" lang="EN-US"><font face="Times New Roman">web.xml</font></span></b><b style=""><span style="font-size: 14pt; font-family: 宋体;">文件</span></b><b style=""><span style="font-size: 14pt;" lang="EN-US"></span></b></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><font face="Times New Roman">Web.xml</font></span><span style="font-family: 宋体;">文件对于配置任何</span><span lang="EN-US"><font face="Times New Roman">Java Web</font></span><span style="font-family: 宋体;">应用都是必须的</span><span lang="EN-US"><font face="Times New Roman">.</font></span><span style="font-family: 宋体;">当配置</span><span lang="EN-US"><font face="Times New Roman">Struts</font></span><span style="font-family: 宋体;">应用时</span><span lang="EN-US"><font face="Times New Roman">,</font></span><span style="font-family: 宋体;">还应该在</span><span lang="EN-US"><font face="Times New Roman">web.xml</font></span><span style="font-family: 宋体;">文件中配置和</span><span lang="EN-US"><font face="Times New Roman">Struts</font></span><span style="font-family: 宋体;">相关的配置选项</span><span lang="EN-US"><font face="Times New Roman">.</font></span><span style="font-family: 宋体;">一下讲述配置</span><span lang="EN-US"><font face="Times New Roman">Struts</font></span><span style="font-family: 宋体;">应用的必要步骤</span><span lang="EN-US"><font face="Times New Roman">.</font></span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><span lang="EN-US"><p><font face="Times New Roman" size="3">&nbsp;</font></p></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><b style=""><span lang="EN-US"><font face="Times New Roman">1</font></span></b><b style=""><span style="font-family: 宋体;">·配置</span><span lang="EN-US"><font face="Times New Roman">Struts</font></span></b><b style=""><span style="font-family: 宋体;">的</span><span lang="EN-US"><font face="Times New Roman">ActionServlet</font></span></b></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;">第一步用</span><span lang="EN-US"><font face="Times New Roman">&lt;servlet&gt;</font></span><span style="font-family: 宋体;">元素来声明</span><span lang="EN-US"><font face="Times New Roman">ActionServlet</font></span><span style="font-family: 宋体;">。</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;">在</span><span lang="EN-US"><font face="Times New Roman">&lt;servlet&gt;</font></span><span style="font-family: 宋体;">的子元素中，经常用到的有：</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><span style=""><font face="Times New Roman">&nbsp;&nbsp; </font></span></span><span style="font-family: 宋体;">·</span><span lang="EN-US"><font face="Times New Roman">&lt;servlet-name&gt;</font></span><span style="font-family: 宋体;">元素用来定义</span><span lang="EN-US"><font face="Times New Roman">Servlet</font></span><span style="font-family: 宋体;">的名称。</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><span style=""><font face="Times New Roman">&nbsp;&nbsp; </font></span></span><span style="font-family: 宋体;">·</span><span lang="EN-US"><font face="Times New Roman">&lt;servlet-class&gt;</font></span><span style="font-family: 宋体;">元素用来置顶</span><span lang="EN-US"><font face="Times New Roman">Servlet</font></span><span style="font-family: 宋体;">的完整类名。</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><span style=""><font face="Times New Roman">&nbsp;&nbsp; </font></span></span><span style="font-family: 宋体;">·</span><span lang="EN-US"><font face="Times New Roman">&lt;init-param&gt;</font></span><span style="font-family: 宋体;">元素用于配置</span><span lang="EN-US"><font face="Times New Roman">Servlet</font></span><span style="font-family: 宋体;">初始化参数。</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;">第二步为配置</span><span lang="EN-US"><font face="Times New Roman">&lt;servlet-mapping&gt;</font></span><span style="font-family: 宋体;">元素，用来指定</span><span lang="EN-US"><font face="Times New Roman">ActionServlet</font></span><span style="font-family: 宋体;">可以处理哪些</span><span lang="EN-US"><font face="Times New Roman">URL</font></span><span style="font-family: 宋体;">。</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;">有子元素</span><span lang="EN-US"><font face="Times New Roman">&lt;servlet-name&gt;</font></span><span style="font-family: 宋体;">和</span><span lang="EN-US"><font face="Times New Roman">&lt;url-pattern&gt;</font></span><span style="font-family: 宋体;">，注意，这里的</span><span lang="EN-US"><font face="Times New Roman">&lt;servlet-name&gt;</font></span><span style="font-family: 宋体;">必须和</span><span lang="EN-US"><font face="Times New Roman">&lt;servlet&gt;</font></span><span style="font-family: 宋体;">元素中的</span><span lang="EN-US"><font face="Times New Roman">&lt;servlet-name&gt;</font></span><span style="font-family: 宋体;">匹配。</span></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span lang="EN-US"><p><font face="Times New Roman" size="3">&nbsp;</font></p></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><font face="Times New Roman">**</font></span><span style="font-family: 宋体;">提示</span><span lang="EN-US"><font face="Times New Roman">**</font></span></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><span style=""><font face="Times New Roman">&nbsp; </font></span></span><span style="font-family: 宋体;">不管应用中包含多少子应用，都只需要配置一个</span><span lang="EN-US"><font face="Times New Roman">ActionServlet</font></span><span style="font-family: 宋体;">。有些开发者希望设置多个</span><span lang="EN-US"><font face="Times New Roman">ActionServlet</font></span><span style="font-family: 宋体;">类来处理应用中不同的功能，其实这是不必要的，因为</span><span lang="EN-US"><font face="Times New Roman">Serlvet</font></span><span style="font-family: 宋体;">本身支持多线程。而且，目前的</span><span lang="EN-US"><font face="Times New Roman">Struts</font></span><span style="font-family: 宋体;">框架只允许在应用中配置一个</span><span lang="EN-US"><font face="Times New Roman">ActionSerlvet</font></span><span style="font-family: 宋体;">。</span></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span lang="EN-US"><p><font face="Times New Roman" size="3">&nbsp;</font></p></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><b style=""><span lang="EN-US"><font face="Times New Roman">2</font></span></b><b style=""><span style="font-family: 宋体;">·配置欢迎文件清单</span><span lang="EN-US"></span></b></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><font face="Times New Roman">&lt;welcome-file-list&gt;</font></span><span style="font-family: 宋体;">元素中可以包含多个</span><span lang="EN-US"><font face="Times New Roman">&lt;welcome-file&gt;</font></span><span style="font-family: 宋体;">子元素，当</span><span lang="EN-US"><font face="Times New Roman">Web</font></span><span style="font-family: 宋体;">容器调用</span><span lang="EN-US"><font face="Times New Roman">Web</font></span><span style="font-family: 宋体;">应用的欢迎文件时，首先寻找第一个</span><span lang="EN-US"><font face="Times New Roman">&lt;welcome-file&gt;</font></span><span style="font-family: 宋体;">指定的文件。如果这个文件存在，将把这一个文件返回给客户；如果这个文件不存在，</span><span lang="EN-US"><font face="Times New Roman">Web</font></span><span style="font-family: 宋体;">容器将依次寻找下一个欢迎文件，直到找到为止；如果都不存在，服务器将向客户返回“</span><span lang="EN-US"><font face="Times New Roman">HTTP <chmetcnv tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="404" unitname="”" w:st="on">404 </chmetcnv>Not Found</font></span><span style="font-family: 宋体;">”的出错信息。</span></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span lang="EN-US"><p><font face="Times New Roman" size="3">&nbsp;</font></p></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><b style=""><span lang="EN-US"><font face="Times New Roman">3</font></span></b><b style=""><span style="font-family: 宋体;">·配置错误处理</span><span lang="EN-US"></span></b></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><span lang="EN-US"><font face="Times New Roman" size="3">&lt;error-page&gt;</font></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><span lang="EN-US"><font size="3"><font face="Times New Roman"><span style="">&nbsp; </span>&lt;error-code&gt;&lt;/error-code&gt;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><span lang="EN-US"><font size="3"><font face="Times New Roman"><span style="">&nbsp; </span>&lt;location&gt;&lt;/location&gt;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><span lang="EN-US"><font face="Times New Roman" size="3">&lt;/error-page&gt;</font></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 10.5pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;">如果在</span><span lang="EN-US"><font face="Times New Roman">web.xml</font></span><span style="font-family: 宋体;">文件中做了以上配置，当</span><span lang="EN-US"><font face="Times New Roman">Web</font></span><span style="font-family: 宋体;">容器捕获到错误时（如：</span><span lang="EN-US"><font face="Times New Roman">HTTP 404</font></span><span style="font-family: 宋体;">、</span><span lang="EN-US"><font face="Times New Roman">HTTP 500</font></span><span style="font-family: 宋体;">），将根据错误代码减缩</span><span lang="EN-US"><font face="Times New Roman">&lt;error-page&gt;</font></span><span style="font-family: 宋体;">的子元素</span><span lang="EN-US"><font face="Times New Roman">&lt;error-code&gt;</font></span><span style="font-family: 宋体;">，如果有匹配项就返回</span><span lang="EN-US"><font face="Times New Roman">&lt;location&gt;</font></span><span style="font-family: 宋体;">子元素指定的文件。</span></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><span style=""><font face="Times New Roman">&nbsp; </font></span></span><span style="font-family: 宋体;">也可以为</span><span lang="EN-US"><font face="Times New Roman">Web</font></span><span style="font-family: 宋体;">容器捕获的</span><span lang="EN-US"><font face="Times New Roman">Java</font></span><span style="font-family: 宋体;">异常配置</span><span lang="EN-US"><font face="Times New Roman">&lt;error-page&gt;</font></span><span style="font-family: 宋体;">元素，这是需要设置</span><span lang="EN-US"><font face="Times New Roman">&lt;exception-type&gt;</font></span><span style="font-family: 宋体;">子元素，它用于指定</span><span lang="EN-US"><font face="Times New Roman">Java</font></span><span style="font-family: 宋体;">异常类。</span><span lang="EN-US"><font face="Times New Roman">Web</font></span><span style="font-family: 宋体;">容器可能捕获如下异常：</span></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><span style=""><font face="Times New Roman">&nbsp; </font></span></span><span style="font-family: 宋体;">·</span><span lang="EN-US"><font face="Times New Roman">RuntimeException</font></span><span style="font-family: 宋体;">或</span><span lang="EN-US"><font face="Times New Roman">Error</font></span><span style="font-family: 宋体;">。</span></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><span style=""><font face="Times New Roman">&nbsp; </font></span></span><span style="font-family: 宋体;">·</span><span lang="EN-US"><font face="Times New Roman">ServletException</font></span><span style="font-family: 宋体;">或它的子类。</span></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><span style=""><font face="Times New Roman">&nbsp; </font></span></span><span style="font-family: 宋体;">·</span><span lang="EN-US"><font face="Times New Roman">IOException</font></span><span style="font-family: 宋体;">或它的子类。</span></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span style="font-family: 宋体;"><font size="3">这里的配置信息如下：</font></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><span lang="EN-US"><font face="Times New Roman" size="3">&lt;error-page&gt;</font></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><span lang="EN-US"><font size="3"><font face="Times New Roman"><span style="">&nbsp; </span>&lt;exception-type&gt;&lt;/exception-type&gt;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><span lang="EN-US"><font size="3"><font face="Times New Roman"><span style="">&nbsp; </span>&lt;location&gt;&lt;/location&gt;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><span lang="EN-US"><font face="Times New Roman" size="3">&lt;/error-page&gt;</font></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span lang="EN-US"><p><font face="Times New Roman" size="3">&nbsp;</font></p></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><b style=""><span lang="EN-US"><font face="Times New Roman">4</font></span></b><b style=""><span style="font-family: 宋体;">·配置</span><span lang="EN-US"><font face="Times New Roman">Struts</font></span></b><b style=""><span style="font-family: 宋体;">标签库</span><span lang="EN-US"></span></b></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span lang="EN-US"><font face="Times New Roman">&lt;taglib&gt;</font></span><span style="font-family: 宋体;">元素有两个子元素：</span><span lang="EN-US"><font face="Times New Roman">&lt;taglib-uri&gt;</font></span><span style="font-family: 宋体;">和</span><span lang="EN-US"><font face="Times New Roman">&lt;taglib-location&gt;</font></span><span style="font-family: 宋体;">。</span><span lang="EN-US"><font face="Times New Roman">&lt;taglib-uri&gt;</font></span><span style="font-family: 宋体;">元素指定标签库的相对或者绝对</span><span lang="EN-US"><font face="Times New Roman">URI</font></span><span style="font-family: 宋体;">地址，</span><span lang="EN-US"><font face="Times New Roman">Web</font></span><span style="font-family: 宋体;">应用将根据这一</span><span lang="EN-US"><font face="Times New Roman">URI</font></span><span style="font-family: 宋体;">来访问标签库；</span><span lang="EN-US"><font face="Times New Roman">&lt;taglib-location&gt;</font></span><span style="font-family: 宋体;">元素指定标签库描述文件在文件资源系统中的物理位置。</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;">如果</span><span lang="EN-US"><font face="Times New Roman">Web</font></span><span style="font-family: 宋体;">应用中没有使用</span><span lang="EN-US"><font face="Times New Roman">Struts</font></span><span style="font-family: 宋体;">标签库，就没有必要在</span><span lang="EN-US"><font face="Times New Roman">web.xml</font></span><span style="font-family: 宋体;">文件中配置它。此外，也可以按以上方式在</span><span lang="EN-US"><font face="Times New Roman">web.xml</font></span><span style="font-family: 宋体;">文件中配置用户自定义的客户化标签库。<br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;"><br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;"><br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;"><br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;"><br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;"><br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;"><br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;"><br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;"><br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;"><br>
</span></font></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 11.25pt;" class="MsoNormal"><font size="3"><span style="font-family: 宋体;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font>2005年04月08日 6:18 PM</p>
<img src ="http://www.blogjava.net/ranxiang/aggbug/17974.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 15:58 <a href="http://www.blogjava.net/ranxiang/articles/17974.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]一些设计Struts应用的策略</title><link>http://www.blogjava.net/ranxiang/articles/17972.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 07:50:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17972.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17972.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17972.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17972.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17972.html</trackback:ping><description><![CDATA[		·JSP文件侧重于生成动态网页，应该将程序代码从JSP文件中分离，JSP文件借助客户华标签来完成视图层的程序逻辑。<br>
<br>
·客户华标签负责视图层的程序逻辑，如数据显示，或者进行会话的有效性验证。客户化标签既可以访问模型组件，也可以访问存放在Web应用的request，session和application范围内的共享数据。<br>
<br>
·ActionForm在对表单数据进行验证时，主要时进行语法和格式的检查，不设计业务逻辑验证。<br>
<br>
·Action组件侧重于业务逻辑验证和流程控制，决定用户请发的转发。Action组件既可以访问模型组件，也可以访问存放在Web应用的request，session和application范围内的共享数据。<br>
<br>
·
模型组件负责十几业务逻辑，如对数据库中数据的查询，添加和删除操作。模型组件应该与视图及控制器保持独立，模型组件不应该访问Servlet
API或Struts
API中的类，例如HttpServletRequest，HttpServletResponse，Action或ActionForm等对象。<br>
<br>
<br>
<br>
<br>
                                  
2005年04月05日 7:45 AM<img src ="http://www.blogjava.net/ranxiang/aggbug/17972.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 15:50 <a href="http://www.blogjava.net/ranxiang/articles/17972.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]Struts中的Action类的工作机制</title><link>http://www.blogjava.net/ranxiang/articles/17970.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 07:40:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17970.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17970.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17970.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17970.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17970.html</trackback:ping><description><![CDATA[
		Struts中的Action类的工作机制<br>
<br>
&nbsp;
所有的Action类都是org.apache.struts.action.Action的子类。Action子类应该覆写父类的execute()方
法。当ActionForm
Bean被创建，并且表单验证顺利通过后，Struts框架就会调用Action类的execute()方法。execute()方法的定义如下：<br>
&nbsp; <br>
&nbsp; public ActionForward execute(ActionMapping mapping<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ActionForm form,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
HttpServletRequest request,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
HttpServletResponse response) throws IOException, ServletException;<br>
&nbsp; <br>
&nbsp; execute()方法包含一下参数：<br>
&nbsp; · ActionMapping：包含了这个Action的配置信息，和struts-config.xml文件中的<br>
&nbsp;&nbsp;&nbsp;&nbsp; &lt;action&gt;元素对应。<br>
&nbsp; · ActionForm：包含了用户的表单数据，当Struts框架调用execute()方法时，<br>
&nbsp;&nbsp;&nbsp;&nbsp; ActionForm中的数据已经通过了表单验证。<br>
&nbsp; · HttpServletRequest：当前的HTTP请求对象。<br>
&nbsp; · HttpServletResponse：当前的HTTP响应对象。<br>
&nbsp; Action类的execute()方法返回ActionForward对象，它包含了请求转发路径信息。<br>
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2005年03月31日 1:30 AM<img src ="http://www.blogjava.net/ranxiang/aggbug/17970.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 15:40 <a href="http://www.blogjava.net/ranxiang/articles/17970.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Struts]Struts的工作流程</title><link>http://www.blogjava.net/ranxiang/articles/17969.html</link><dc:creator>冉翔</dc:creator><author>冉翔</author><pubDate>Thu, 03 Nov 2005 07:38:00 GMT</pubDate><guid>http://www.blogjava.net/ranxiang/articles/17969.html</guid><wfw:comment>http://www.blogjava.net/ranxiang/comments/17969.html</wfw:comment><comments>http://www.blogjava.net/ranxiang/articles/17969.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ranxiang/comments/commentRss/17969.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ranxiang/services/trackbacks/17969.html</trackback:ping><description><![CDATA[
		Struts的工作流程<br>
<br>
&nbsp;
对于采用Struts框架的Web应用，在Web应用启动时就会加载兵初始化ActionServlet，ActionServlet从struts-
config.xml文件中读取配置信息，把它们存放到各种配置对象中，例如Action的映射信息存放在ActionMapping对象中。<br>
<br>
&nbsp; 当ActionServlet接受到一个客户请求时，将执行如下流程。<br>
<br>
流程：<br>
<br>
&nbsp;（1）减缩和用户请求匹配的ActionMapping实例，如果不存在，就返回用户请求路径无效的信息。<br>
&nbsp;（2）如果ActionForm实例不存在，就创建一个ActionForm对象，把客户提交的表单数据保存到ActionForm对象中。<br>
&nbsp;（3）根据配置信息决定是否需要表单验证。如果需要验证，就调用ActionForm的validate()方法。<br>
&nbsp;（4）如果ActionForm的validate()方法返回null或返回一个不包含ActionMessage的ActionErrors对象，就表示表单验证成功。<br>
&nbsp;（5）ActionServlet根据ActionMapping实例包含的映射信息决定将请求转发给哪个Action。如果相应的Action实例不存在，就先创建这个实例，然后调用Action的execute()方法。<br>
&nbsp;（6）Action的execute()方法返回一个ActionForward对象，ActinoServlet再把客户请求转发给ActionForward对象只想的JSP组件。<br>
&nbsp;（7）ActionForward对象指向的JSP组件生成动态网页，返回给客户。<br>
<br>
&nbsp;
对于以上流程的流程（4），如果ActionForm的validate()方法返回一个或多个ActionMessage的ActionErrors对
象，就表示表单验证失败，此时ActionServlet将直接把请求转发给包含用户提交表单的JSP组件。再这种情况下，不会再创建Action对象并
调用Action的execute()方法。<br>
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; －－以上文字摘自孙卫琴，《精通Struts：基于MVC的Java Web设计与开发》<br>
<br>
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2005年03月30日 12:25 AM<img src ="http://www.blogjava.net/ranxiang/aggbug/17969.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ranxiang/" target="_blank">冉翔</a> 2005-11-03 15:38 <a href="http://www.blogjava.net/ranxiang/articles/17969.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>