﻿<?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-Flyingis-随笔分类-Web 框架与开发</title><link>http://www.blogjava.net/flyingis/category/4271.html</link><description>Talking and thinking freely !&lt;br&gt;
Flying in the world of Java and GIS !</description><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 12:25:41 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 12:25:41 GMT</pubDate><ttl>60</ttl><item><title>MVC的一幅简单素描</title><link>http://www.blogjava.net/flyingis/archive/2006/03/27/37657.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Mon, 27 Mar 2006 09:50:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2006/03/27/37657.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/37657.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2006/03/27/37657.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/37657.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/37657.html</trackback:ping><description><![CDATA[
		<font size="2"> <span lang="ZH-CN" style="FONT-FAMILY: SimSun">作者：</span><span lang="EN-US" style="FONT-FAMILY: Verdana"><a class="" title="" href="/flyingis/" target="_blank"><font color="#000080">Flyingis</font></a></span></font>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: SimSun"> </p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">素描工具：</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">Struts + Hibernate 3</span>
		</p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">素描对象：一个足够简单的基于</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">MVC</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">的</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">Web</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">应用</span>
		</p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">目的：使用</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">Struts</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">分离业务逻辑与表现，使用</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">Hibernate</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">分离数据操作与业务逻辑，整理一种基本的</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">MVC</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">开发思路。</span>
		</p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: SimSun"> </p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="EN-US" style="FONT-FAMILY: Verdana">1.</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">素描框架<br /></span> </p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: SimSun">    该素描主要体现在系统层次的功能划分，系统结构的组织与设计上，素描足够简单，数据库中只涉及一张表：</p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: SimSun">    学生信息（学生编号、姓名、性别、年龄、专业信息）--Student( id, name, gender, age, specialty_id )</p>
		<ul>
				<li>
						<div style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle">
								<span style="FONT-FAMILY: SimSun">系统设计</span>
						</div>
				</li>
		</ul>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: SimSun">    公共类的设计与实现</p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">    各模块的详细设计，主要描述一个基本的</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">CRUD</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">操作，以及对象数据传递</span>
		</p>
		<ul>
				<li>
						<div style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle">
								<span style="FONT-FAMILY: SimSun">系统的部署、测试与发布</span>
						</div>
				</li>
		</ul>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="EN-US" style="FONT-FAMILY: Verdana">2.</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">公共类设计<br /></span> </p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">    基本的</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">CRUD</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">操作封装在基本的帮助类</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">HibernateHelper</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">中，实现</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">Object load(Class theClass, java.io.Serializable id)</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">、</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">Query createQuery(String queryString)</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">、</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">void setQueryParameter(Query query, String name, Object val)</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">、</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">List list(Query query)</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">、</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">void save(Object o)</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">、</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">void update(Object o)</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">、</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">void delete(Object o)</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">、</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">void saveOrUpdate(Object o)</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">等这些基本方法。<br /></span> </p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">    常量单独封装在</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">Constants</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">类中。</span>
		</p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: SimSun"> </p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="EN-US" style="FONT-FAMILY: Verdana">3.</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">各种对象设计</span>
		</p>
		<ul>
				<li>
						<div style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle">
								<span lang="EN-US" style="FONT-FAMILY: Verdana">ActionForm:StudentForm--</span>
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">用于视图层与控制层之间传递数据。</span>
						</div>
				</li>
				<li>
						<div style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle">
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">接口</span>
								<span lang="EN-US" style="FONT-FAMILY: Verdana">StudentIf--</span>
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">实现了学生数据对象</span>
								<span lang="EN-US" style="FONT-FAMILY: Verdana">Bean</span>
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">所需要的所有接口方法。</span>
						</div>
				</li>
				<li>
						<div style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle">
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">学生数据对象</span>
								<span lang="EN-US" style="FONT-FAMILY: Verdana">StudentData--</span>
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">实现了记录学生对象数据的功能，并可以用作数据交互的传输对象，它实现了接口</span>
								<span lang="EN-US" style="FONT-FAMILY: Verdana">Serializable</span>
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">和</span>
								<span lang="EN-US" style="FONT-FAMILY: Verdana">StudentIf</span>
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">。</span>
						</div>
				</li>
				<li>
						<div style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle">
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">学生实体</span>
								<span lang="EN-US" style="FONT-FAMILY: Verdana">Bean StudentBean--</span>
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">实现了学生实体的所有属性，它实现了接口</span>
								<span lang="EN-US" style="FONT-FAMILY: Verdana">Serializable</span>
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">和</span>
								<span lang="EN-US" style="FONT-FAMILY: Verdana">StudentIf</span>
								<span lang="ZH-CN" style="FONT-FAMILY: SimSun">。</span>
						</div>
				</li>
		</ul>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="EN-US" style="FONT-FAMILY: Verdana">4.</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">对象管理实现类<br /></span> <br /></p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">    业务逻辑处理为项目的核心，直接关系到项目是否符合用户需求。因此，我们可以单独设计一个对象管理实现类</span>
				<font face="Verdana">ManagerFacade</font>，定义处理业务对象的<span lang="EN-US" style="FONT-FAMILY: Verdana">CRUD</span><span lang="ZH-CN" style="FONT-FAMILY: SimSun">操作，以增加学生信息为例</span><span lang="EN-US" style="FONT-FAMILY: Verdana">public StudentIf addStudent(StudentIf student)</span><span lang="ZH-CN" style="FONT-FAMILY: SimSun">。学生数据对象</span><span lang="EN-US" style="FONT-FAMILY: Verdana">StudentData</span><span lang="ZH-CN" style="FONT-FAMILY: SimSun">在</span><span lang="EN-US" style="FONT-FAMILY: Verdana">Action</span><span lang="ZH-CN" style="FONT-FAMILY: SimSun">中通过</span><span lang="EN-US" style="FONT-FAMILY: Verdana">StudentForm</span><span lang="ZH-CN" style="FONT-FAMILY: SimSun">接收到表现层传入的数据，然后作为<font face="Verdana">ManagerFacade对象的</font></span><span lang="EN-US" style="FONT-FAMILY: Verdana">addStudent</span><span lang="ZH-CN" style="FONT-FAMILY: SimSun">方法的参数传入方法内，在方法体内声明学生实体</span><span lang="EN-US" style="FONT-FAMILY: Verdana">StudentBean</span><span lang="ZH-CN" style="FONT-FAMILY: SimSun">的一个对象，将学生数据对象即传入参数中的属性值赋给实体对象，然后调用公共类<span lang="EN-US" style="FONT-FAMILY: Verdana">HibernateHelper的</span></span><span lang="EN-US" style="FONT-FAMILY: Verdana">save</span><span lang="ZH-CN" style="FONT-FAMILY: SimSun">方法完成数据库操作。其他基本操作与此类似，这样设计似乎对象较多，但各层之间分工明确，有利于降藕。<br /></span></p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: SimSun">    另外，在数据传递过程中，还会涉及到数据类型的转换，可以专门设计帮助类来完成。</p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: SimSun"> </p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="EN-US" style="FONT-FAMILY: Verdana">5.</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">页面</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">UI</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">设计<br /></span> </p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">    除了设计美观的页面外，最重要的是页面结构要符合项目需要，并提供一定的使用体验，有时候简单实用就是最好。如果可以对用户浏览器统一规范要求，或是基本不会屏蔽</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">Javascript</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">，数据格式的控制可以放在客户端用</span>
				<span lang="EN-US" style="FONT-FAMILY: Verdana">Javascript</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">实现。</span>
		</p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: SimSun"> </p>
		<p style="FONT-SIZE: 10pt; MARGIN: 0in">
				<span lang="EN-US" style="FONT-FAMILY: Verdana">6.</span>
				<span lang="ZH-CN" style="FONT-FAMILY: SimSun">系统的部署、测试与发布。</span>
		</p>
<img src ="http://www.blogjava.net/flyingis/aggbug/37657.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2006-03-27 17:50 <a href="http://www.blogjava.net/flyingis/archive/2006/03/27/37657.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web应用系统设计原则</title><link>http://www.blogjava.net/flyingis/archive/2006/03/25/37345.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Sat, 25 Mar 2006 07:28:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2006/03/25/37345.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/37345.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2006/03/25/37345.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/37345.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/37345.html</trackback:ping><description><![CDATA[
		<font size="2">
				<font face="Verdana">    作者：</font>
				<a class="" title="" href="/flyingis/" target="_blank">
						<font face="Verdana" color="#000080">Flyingis</font>
				</a>
				<br />
				<br />
				<font face="Verdana">    和C/S结构相比，B/S结构受限于网络带宽不利于进行大数据量的统计分析，网络传输存在潜在的安全问题，还有用户界面不及C/S结构友好等等，但随着网络带宽和网络应用的发展，加上AJAX技术的流行，使得现在越来越多的MIS系统或基于MIS系统的专业化应用系统都开始倾向于采用B/S结构进行设计，充分利用B/S结构的优点。但是，要充分发挥Web应用的内在潜力，挖掘应用深度和扩大适应能力，需要采用先进的应用架构和以实用为根本准则，使得系统既能满足业务需求，又能适应将来发展需要。因此，在开发Web应用系统时需要尽量遵循Web应用系统设计原则。<br /><br />    实用性原则：这是所有应用软件最基本的原则，直接衡量系统的成败，每一个提交到用户手中的系统都应该是实用的，能解决用户的实际问题，否则该设计就是垃圾。<br /><br />    适应性和可扩展性原则：系统需要具备一定的适应能力，特别是Web应用要能适应于多种运行环境，来应对未来变化的环境和需求。可扩展性主要体现在系统易于扩展，例如可以采用分布式设计、系统结构模块化设计，系统架构可以根据网络环境和用户的访问量而适时调整，从某种程度上说，这也是系统的适应性。<br /><br />    可靠性原则：系统应该是可靠的，在出现异常的时候应该有人性化的异常信息方便用户理解原因，或采取适当的应对方案，在设计业务量比较大的时候可采用先进的嵌入式技术来保证业务的流畅运行。<br /><br />    可维护性和可管理性原则：Web系统应该有一个完善的管理机制，而可维护性和可管理性是重要的两个指标。<br /><br />    安全性原则：现在的计算机病毒几乎都来自于网络，Web应用应尽量采用五层安全体系，即网络层安全、系统安全、用户安全、用户程序的安全和数据安全。系统必须具备高可靠性，对使用信息进行严格的权限管理，技术上，应采用严格的安全与保密措施，保证系统的可靠性、保密性和数据一致性等。<br /><br />    总体规划、分层实施原则：在开始设计之前应该对Web系统进行总体设计，然后在总体设计指导下分步开发。基于J2EE技术的应用系统是一个融合了多元信息的集成系统，现在一般都采用分层开发：表现层、控制层、业务逻辑层、模型层、数据访问层等，在适应系统需求的准则下，设计低耦合的分层结构，利于团队成员的分工协作，提高开发效率，降低项目风险，实现各个模块的功能设计，完成整个系统的开发。</font>
		</font>
<img src ="http://www.blogjava.net/flyingis/aggbug/37345.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2006-03-25 15:28 <a href="http://www.blogjava.net/flyingis/archive/2006/03/25/37345.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重温Struts--ActionForm</title><link>http://www.blogjava.net/flyingis/archive/2006/03/18/35995.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Sat, 18 Mar 2006 14:40:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2006/03/18/35995.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/35995.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2006/03/18/35995.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/35995.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/35995.html</trackback:ping><description><![CDATA[
		<p style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 20pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0">
				<span style="FONT-SIZE: 10pt">
						<font face="宋体">作者：<span lang="EN-US" style="COLOR: navy"><a href="/flyingis/" target="_blank"><span style="COLOR: navy"><font color="#000080">Flyingis</font></span></a></span><span lang="EN-US"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:p></o:p></span></font>
				</span>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 20pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0">
				<font face="宋体">
						<span lang="EN-US" style="FONT-SIZE: 10pt">ActionForm</span>
						<span style="FONT-SIZE: 10pt">是<span lang="EN-US">Struts</span>设计中比较有争议的一个概念，在某些情况下也许不会使用到<span lang="EN-US">ActionForm</span>，具体可以参照<span lang="EN-US" style="COLOR: navy"><a href="/flyingis/archive/2005/11/18/20458.html"><font color="#000080"><span lang="EN-US" style="COLOR: navy"><span lang="EN-US">《Struts Action</span></span><span lang="EN-US" style="COLOR: navy"><span lang="EN-US">的多种角色</span></span><span lang="EN-US" style="COLOR: navy"><span lang="EN-US">》</span></span></font></a></span>一文。尽管如此，<span lang="EN-US">ActionForm</span>在许多应用的开发中都实现了重要的功能，它是<span lang="EN-US">Struts</span>框架提供的<span lang="EN-US">DTO</span>，用于在视图层和控制层之间传递<span lang="EN-US">HTML</span>表单数据，控制层可以从<span lang="EN-US">ActionForm Bean</span>中读取用户输入的表单数据，也可以把来自模型层的数据存放到<span lang="EN-US">ActionForm Bean</span>中，返回给视图，即使用它的主要目的是字段采集、类型转换器、以及传输对象等。对于<span lang="EN-US">ActionForm Bean</span>在<span lang="EN-US">MVC</span>中所处层次结构的理解，可以参考<span lang="EN-US" style="COLOR: navy"><a href="/flyingis/archive/2006/03/17/35752.html"><font color="#000080"><span lang="EN-US" style="COLOR: navy"><span lang="EN-US">《剖析MVC</span></span><span lang="EN-US" style="COLOR: navy"><span lang="EN-US">中的各种Object</span></span><span lang="EN-US" style="COLOR: navy"><span lang="EN-US">》</span></span></font></a></span>。<span lang="EN-US"><o:p></o:p></span></span>
				</font>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm">
				<font face="宋体">
						<b style="mso-bidi-font-weight: normal">
								<span lang="EN-US" style="FONT-SIZE: 10pt">ActionForm</span>
						</b>
						<b style="mso-bidi-font-weight: normal">
								<span style="FONT-SIZE: 10pt">的基本功能<span lang="EN-US"><o:p></o:p></span></span>
						</b>
				</font>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm">
				<font face="宋体">
						<span lang="EN-US" style="FONT-SIZE: 10pt">1.</span>
						<span style="FONT-SIZE: 10pt">字段采集<span lang="EN-US"><o:p></o:p></span></span>
				</font>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 20pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0">
				<span style="FONT-SIZE: 10pt">
						<font face="宋体">在<span lang="EN-US">Web</span>应用程序开发过程中，数据的采集是最基本的一个环节，而<span lang="EN-US">html</span>定义的数据输入控件和<span lang="EN-US">http</span>定义的数据传输协议非常简单，因此在<span lang="EN-US">Struts</span>中设计了<span lang="EN-US">ActionForm</span>来弥补这种不足。<span lang="EN-US">Struts</span>对<span lang="EN-US">http</span>参数处理的方法是将输入参数传递到<span lang="EN-US">JavaBean</span>属性来进行处理，当<span lang="EN-US">ActionForm</span>的属性与某个请求参数匹配，框架自动以参数的值设置属性。<span lang="EN-US"><o:p></o:p></span></font>
				</span>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm">
				<font face="宋体">
						<span lang="EN-US" style="FONT-SIZE: 10pt">2.</span>
						<span style="FONT-SIZE: 10pt">数据校验器<span lang="EN-US"><o:p></o:p></span></span>
				</font>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 20.25pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm">
				<font face="宋体">
						<span lang="EN-US" style="FONT-SIZE: 10pt">Html</span>
						<span style="FONT-SIZE: 10pt">没有在数据提交之前对数据进行校验的能力，使用<span lang="EN-US">javascript</span>可以做到这些，优点在于可以减轻服务器负担，但<span lang="EN-US">javascript</span>经常会被浏览器禁止，因此，在<span lang="EN-US">Struts</span>中<span lang="EN-US">ActionForm</span>实现了部分数据校验的功能，当输入数据不符合要求时，页面将被返回到数据数据页面，要求用户重新输入。一般情况下，<span lang="EN-US">ActionForm</span>属性定义为<span lang="EN-US">String</span>类型，以便对各种输入进行捕获。另外，还可以用<span lang="EN-US">ActionForm</span>和<span lang="EN-US">Action</span>对输入数据进行双重校验，<span lang="EN-US">ActionForm</span>校验数据类型是否正确，<span lang="EN-US">Action</span>校验该数据是否满足业务层的其他要求。<span lang="EN-US"><o:p></o:p></span></span>
				</font>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm">
				<font face="宋体">
						<span lang="EN-US" style="FONT-SIZE: 10pt">3.</span>
						<span style="FONT-SIZE: 10pt">类型转换<span lang="EN-US"><o:p></o:p></span></span>
				</font>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 20.25pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm">
				<font face="宋体">
						<span lang="EN-US" style="FONT-SIZE: 10pt">HTML</span>
						<span style="FONT-SIZE: 10pt">表单中的数据类型一般是<span lang="EN-US">String</span>或<span lang="EN-US">boolean</span>类型，通过在<span lang="EN-US">ActionForm Bean</span>中实现<span lang="EN-US">Helper</span>方法，可以实现属性类型的转换。<span lang="EN-US"><o:p></o:p></span></span>
				</font>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm">
				<font face="宋体">
						<span lang="EN-US" style="FONT-SIZE: 10pt">4.</span>
						<span style="FONT-SIZE: 10pt">传输对象<span lang="EN-US"><o:p></o:p></span></span>
				</font>
		</p>
		<p style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 20.25pt; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm">
				<font face="宋体">
						<span lang="EN-US" style="FONT-SIZE: 10pt">ActionForm</span>
						<span style="FONT-SIZE: 10pt">可以作为其他<span lang="EN-US">Bean</span>的数据载体，它装载的数据通常对应着持久层中的不止一个实体。<span lang="EN-US"><o:p></o:p></span></span>
				</font>
		</p>
<img src ="http://www.blogjava.net/flyingis/aggbug/35995.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2006-03-18 22:40 <a href="http://www.blogjava.net/flyingis/archive/2006/03/18/35995.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>剖析MVC中的各种Object</title><link>http://www.blogjava.net/flyingis/archive/2006/03/17/35752.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Thu, 16 Mar 2006 16:28:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2006/03/17/35752.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/35752.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2006/03/17/35752.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/35752.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/35752.html</trackback:ping><description><![CDATA[
		<p>
				<font face="Verdana" size="2">    作者：</font>
				<a href="/flyingis/" target="_blank">
						<font face="Verdana" color="#000080" size="2">Flyingis</font>
				</a>
				<br />
				<br />
				<font face="Verdana" size="2">    在Web应用和J2EE框架中经常可以碰到各种Object相关的名词，在网上搜索了一下，讨论各种Object术语的帖子一大筐，大的讨论整个框架，小的描述各个层次之间的细微差别，甚至有钻牛角尖之嫌。</font>
				<a href="/" target="_blank">
						<font face="Verdana" color="#000080" size="2">BlogJava</font>
				</a>
				<font face="Verdana" size="2">上也有讨论VO和PO的贴子，例如</font>
				<a href="/Tower/" target="_blank">
						<font face="Verdana" color="#000080" size="2">非飞</font>
				</a>
				<font face="Verdana" size="2">的</font>
				<a href="/Tower/archive/2005/03/01/1584.html" target="_blank">
						<font face="Verdana" color="#000080" size="2">《各层共享使用PO的代价》</font>
				</a>
				<font face="Verdana" size="2">等。其实无论怎么讨论，这些术语、分层结构、应用框架无非都是为我们的应用而服务的，因此，我们需要的是理解这些术语提出的意义，是理解我们的项目需求，是理解我们采用的框架结构能否最大限度的满足项目的需要。<br /><br />    在刚刚学习MVC/Model2之前，我是不了解VO/TO/PO/DTO/BO等等这些术语的含义的，至少理解上只是停留在浅层面，现在多看了一些，做了一点项目，多了些想法，但肯定还是存在理解上的偏差或误解，欢迎大家讨论指出！<br /><br />    VO: 通常指ValueObject或ViewObject。ViewObject指的是UI需要的对象，Struts的FormBean就是其中的一种，它是Value Object和Transfer Object的总称。<br /><br />    TO: Transfer Object，它和Value Object的区别可以参考Patterns of Enterprise Application Architecture。<br /><br />    PO: Persistent Object，即可以被持久化的实体对象。<br /><br />    </font>
				<a href="http://www.martinfowler.com/bliki/POJO.html" target="_blank">
						<font face="Verdana" color="#000080" size="2">POJO</font>
				</a>
				<font face="Verdana" size="2">: Plain Ordinary Java Object。<br /><br />    DTO: Data Transfer Object，J2EE 中常用的一种设计模式，现在一般可以将使用Value Object的模式称为DTO模式，在</font>
				<a href="http://www.jdon.com/" target="_blank">
						<font face="Verdana" color="#000080" size="2">Jdon</font>
				</a>
				<font face="Verdana" size="2">上一篇<a href="http://www.jdon.com/jive/article.jsp?forum=91&amp;thread=23672" target="_blank"><font color="#000080">《ValueObject和DTO模式的一些疑问》</font></a></font>
				<font face="Verdana" size="2">阐述了两者的关系。<br /><br />    BO: Business Object，可以分为三种情况，只包含业务对象的属性，或只包含业务方法，或两者都包含。对于BO的详细讨论，可以</font>
				<a href="http://www.jdon.com/jive/article.jsp?forum=91&amp;thread=21571" target="_blank">
						<font face="Verdana" color="#000080" size="2">参见这里</font>
				</a>
				<font face="Verdana" size="2">。<br /><br />    这些概念经常交错在一起提出，给初学者造成了一些理解上的困难，其实只需要理顺下面几点，基本上就能弄清楚层次之前的前后关系和如何合理使用这些对象。<br /><br />    1. VO能否和PO相同。首先回答是肯定的，VO是概念模型的一种抽象反映，当一个业务实体可以用一个物理实体表示的时候，VO和PO属性相同，那么它们是相等的。例如学生成绩管理系统中，成绩表单业务实体中包含学生信息、课程信息、成绩等，此时它已经不能用一个物理实体所能描述，而其中的学生信息，其VO和PO在属性上是一样的，此时的VO和PO相同。<br /><br />    2. PO能否代替VO。仅仅从功能实现上来说，当VO和PO相同的时候，PO可以代替VO，这样可以减少一些代码量，但需要注意的是，这样会带来一些问题：当一个业务实体需要多个物理实体来表达的时候，在客户端显示一个业务实体就会多次访问数据库，即进行多次单表访问，非视图；当一个业务实体属性远少于一个物理实体的时候，可能会因装载过多不必要的数据而影响网络传输；对物理实体进行改动的时候会直接影响到表现层。简单的说，这样做增加了代码的耦合性，也增加了代码维护的难度，项目的可扩展性也大大降低，如果仅仅是为了减少代码量而付出这些代将显然是不值的，当然极为简单的应用可以考虑，一切从项目实际出发。<br /><br />    3. VO包含的属性可以多于PO、少于PO、或等于PO中的属性。<br /><br />    4. 一个基于Struts应用的简单数据提交流程(VO和PO单独存在)：HTML 页面中包含了基本的信息，例如文本框、下拉框、单选等，构建一个ActionForm Bean与之一一对应，它是Web层数据的表示，当Web页面的操作流程发生改变的时候，需要对它进行修改，但不能将修改传递到业务层和持久层。然后Action读取ActionForm Bean的属性，构造PO对象，调用BO ，当BO收到这个PO之后，调用DAO接口方法，对PO进行持久化操作，完成数据的提交。这里，PO在业务层和持久层之间，没有被传递到Web层的View中去。<br /><br />    5. 一个基于Struts应用的简单数据查询流程(VO和PO单独存在)：Action读取ActionForm Bean中的查询属性信息，然后调用BO，BO获取ActionForm Bean之后调用DAO接口进行查询，返回所要查询的PO对象，交给Action，Action通过该PO构建 ActionForm Bean，通过request.setAttribute()或session.setAttribute()，重定向到查询结果页面输出需要的信息。<br /><br />    6. 表现层中的字段一般定义为String或boolean类型，因此VO中的属性在传到Action并构建PO对象时需要进行数据类型的转换，或由ActionForm的helper方法来进行转换。<br /><br />    参考文章和贴子：<br />    </font>
				<a href="http://www.jdon.com/jive/article.jsp?forum=91&amp;thread=23672" target="_blank">
						<font face="Verdana" color="#000080" size="2">http://www.jdon.com/jive/article.jsp?forum=91&amp;thread=23672</font>
				</a>
				<br />
				<font size="2">
						<font face="Verdana">    </font>
				</font>
				<a href="http://www.jdon.com/jive/article.jsp?forum=91&amp;thread=21571" target="_blank">
						<font face="Verdana" color="#000080" size="2">http://www.jdon.com/jive/article.jsp?forum=91&amp;thread=21571</font>
				</a>
				<br />
				<font face="Verdana" size="2">    </font>
				<a href="http://www.hibernate.org.cn/viewtopic.php?t=627&amp;postdays=0&amp;postorder=asc&amp;start=0" target="_blank">
						<font face="Verdana" color="#000080" size="2">http://www.hibernate.org.cn/viewtopic.php?t=627&amp;postdays=0&amp;postorder=asc&amp;start=0</font>
				</a>
				<font face="Verdana" size="2">
						<br />    </font>
				<a href="http://bbs.hidotnet.com/704/ShowPost.aspx" target="_blank">
						<font face="Verdana" color="#000080" size="2">http://bbs.hidotnet.com/704/ShowPost.aspx</font>
				</a>
				<br />
				<font face="Verdana" size="2">    </font>
				<a href="http://lifework.cnblogs.com/archive/2005/09/03/229596.html" target="_blank">
						<font face="Verdana" color="#000080" size="2">http://lifework.cnblogs.com/archive/2005/09/03/229596.html</font>
				</a>
				<br />
				<font face="Verdana" size="2">    </font>
				<a href="http://www.microsoft.com/china/MSDN/library/architecture/patterns/esp/DesDTO.mspx" target="_blank">
						<font face="Verdana" color="#000080" size="2">http://www.microsoft.com/china/MSDN/library/architecture/patterns/esp/DesDTO.mspx</font>
				</a>
				<font face="Verdana" size="2">  </font>
		</p>
<img src ="http://www.blogjava.net/flyingis/aggbug/35752.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2006-03-17 00:28 <a href="http://www.blogjava.net/flyingis/archive/2006/03/17/35752.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重温Struts--标签</title><link>http://www.blogjava.net/flyingis/archive/2006/03/12/34893.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Sun, 12 Mar 2006 01:23:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2006/03/12/34893.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/34893.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2006/03/12/34893.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/34893.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/34893.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">作者：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: navy"><A HREF="/flyingis"><SPAN style="COLOR: navy">Flyingis</SPAN></A></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签提供了大部分应用来满足创建</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">MVC</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">架构表现页面的所有功能。在一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">MVC</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用中，请求并不是直接到达表现页面，而是首先经过控制器，仅当业务数据被获取，并且业务规则被应用后，控制器才处理表现页面。页面的职责就是输出结果和捕获用户输入，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签的功能目的就在于此。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">虽说</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签库能满足我们大多数情况下的需要，但不是唯一可用的标签，例如</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">JSTL</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">DisplayTag</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等等。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签和其他各种标签的基本使用方法在各种书本上都有介绍，这里总结一下标签使用中的个人体会，并不断更新。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中包含三个标签库，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Bean</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Logic</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，其中</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签库依赖于框架，其他大部分标签不依赖于框架，可以在其他应用中使用。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签和一般</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签具有一定的对应关系，但也存在一点不同。使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Scriptlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签需要在使用前在页面中将</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Form Bean</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">声明为一个脚本变量，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签则不需要声明就能找到该</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Bean</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。在默认情况下，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签将对剩下的表单使用同一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Bean</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，所以不需要对每一个控件都进行指定。例如：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><BR>&lt;input type=“text” name=“username” value=“&lt;%=user.getUsername()%&gt;”/&gt;<BR></SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><BR>&lt;html:text property=“username”&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签和一般</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签具有一定的对应关系，但存在几个特例，在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签中，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Messages / errors / rewrite</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分别用来表示显示一组消息、显示一组错误消息、输出一个编码的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">URL</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">路径，而这些在一般</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签中就不存在。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">4.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有时需要处理特殊的字符，包括标签的括号、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">&amp;</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">符号以及其他的内容，如果这些字符作为文本字段的一部分，可能会出现错误并造成</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">崩溃。如果确实需要在数据中存储这些字符，可以在网页中进行设置，使得这些字符不被页面过滤成为特殊字符，例如：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><BR>&lt;bean:write name=“UserForm” property=“username” filter=“false”/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">5.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">&lt;html:password&gt;</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，如果页面校验错误，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">password</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性将从</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Form Bean</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中读回，并放置在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">password</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标签中。虽然密码会被浏览器用符号隐藏，但在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">HTML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">源代码中仍然可以看到，存在安全上的隐患，因此可以在标签中加入</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">redisplay=false</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来保证</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">password</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">总是以空白状态显示给用户。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">6.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Javascript</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的返回按钮，可以定义一个没有属性的简单表单，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置文件：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><BR>&lt;action path=“/adduser”<BR><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>type=“org.apache.struts.ForwardAction”<BR><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>name=“BlankForm”<BR><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>scope=“request”<BR><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>validate=“false”<BR><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>parameter=“/user.do”&gt;<BR>JSP</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><BR>&lt;html:form action=“/adduser”&gt;<BR>&lt;html:button property=“page” onClick=“history.go(-1)”&gt;here&lt;/html:button&gt;<BR>&lt;/html:form&gt;<o:p></o:p></SPAN></P><img src ="http://www.blogjava.net/flyingis/aggbug/34893.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2006-03-12 09:23 <a href="http://www.blogjava.net/flyingis/archive/2006/03/12/34893.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重温Struts--Validator和Tiles</title><link>http://www.blogjava.net/flyingis/archive/2006/03/08/34272.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Wed, 08 Mar 2006 06:52:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2006/03/08/34272.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/34272.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2006/03/08/34272.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/34272.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/34272.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'">作者：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: navy; mso-hansi-font-family: 宋体"><A HREF="/flyingis"><SPAN style="COLOR: navy">Flyingis</SPAN></A></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-hansi-font-family: 宋体"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">今天要回顾的是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Tiles</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">以及简单的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Plugin</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">实现，刚刚登录</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">blogjava</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">就发现</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><A HREF="/fidodido/"><SPAN style="COLOR: navy">Mustang</SPAN></A></SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">已经发了两篇好文《在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">中使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">实现可配置的信息校验</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><A HREF="/fidodido/archive/2006/03/07/34123.html"><SPAN style="COLOR: brown">(</SPAN><SPAN lang=EN-US style="COLOR: brown; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN lang=EN-US>一</SPAN></SPAN><SPAN style="COLOR: brown">)</SPAN></A><SPAN style="COLOR: brown">&nbsp;</SPAN><A HREF="/fidodido/archive/2006/03/07/34130.html"><SPAN style="COLOR: brown">(</SPAN><SPAN lang=EN-US style="COLOR: brown; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN lang=EN-US>二</SPAN></SPAN><SPAN style="COLOR: brown">)</SPAN></A></SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">》，本文则从实现流程来总结</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">的使用方法，并针对</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Tiles</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">等</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Struts PlugIn</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">插件略谈一些个人心得。</SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 12pt">Validator<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForm</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，将数据的验证工作放在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">validator()</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法中虽说是一个可行的方法，但在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForm</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中编写特定的验证逻辑会降低</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForm</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的重用性，并给系统的维护带来麻烦。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">框架可以将验证逻辑移至</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForm</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之外，实现</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Javascript</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">客户端验证或服务器段验证。具体实现</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">验证步骤如下：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是以</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">plugin</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的方式来扩充</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">功能的，需要在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts-config.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中声明这个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">plugin</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">导入</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的资源信息，用来向用户提示验证中出现的异常消息。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以支持国际化信息，为每一个国际化信息提供对应的资源信息。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">利用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">validaton.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件来定义用户需要验证的每一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">JSP</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表单中的每一个字段的验证规则，其中可以利用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">validator-rules.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中已经设计好了的验证器，也可以自定义验证方式。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; TEXT-INDENT: -18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">4.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">客户端验证需要</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">validator-rules.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中已提供的验证规则，或是自定义规则，然后在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">jsp</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面中声明</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">&lt;html:form action=“/<I style="mso-bidi-font-style: normal">action</I>.do” onsubmit=“return validate<I style="mso-bidi-font-style: normal">ActionForm</I>(this);”&gt;</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，加上可以生成实现验证的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Javascript</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">代码</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">&lt;html:javascript formName=“<I style="mso-bidi-font-style: normal">ActionForm</I>” staticJavascript=“true”/&gt;</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。服务器端验证同样需要</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">validator-rules.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中已提供的验证规则，或是自定义规则，另外，实现验证的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForm</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">需要是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">DynaActionForm</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的子类，和客户端验证不同的是，在捕获服务器端错误消息时，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">jsp</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面中需要嵌入代码</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 17.85pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt">&lt;html:messages id=“error”&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 17.85pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;bean:write name=“error”/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt 18pt; mso-para-margin-bottom: .5gd; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 18.0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt">&lt;/html:messages&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在配置和设计</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Web</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">系统验证功能的时候，需要注意的是要理解在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">validaton.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中定义验证规则的时候每个参数的具体功能，我最初使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的时候就因为参数混淆而验证失败，费了一点时间。还有就是自定义验证规则时，需要注意每个参数的具体含义，例如在某种情况下，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">validaton.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">里</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">&lt;var-name&gt;myproperty&lt;/var-name&gt;</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中自定义的属性</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">myproperty</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">需要和自己编写的验证器类中的代码一致等等。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 12pt">Tiles<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN lang=EN-US style="FONT-SIZE: 10pt">Tiles</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是一个模板机制，它可以让网页的配置框架和内容分离，提供一个版面管理机制。通常有两种方式管理</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Tiles</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置资源，一种使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">XML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，另一种使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">JSP</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面直接管理。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">XML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Tiles</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以支持国际化，例如可以另存为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">tiles-defs.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">并命名为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">tiles-defs_zh.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，将</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">encoding</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">改为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">GB2312</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，这样可以在配置中使用中文。使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">XML</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置文件可以方便的实现版面配置和内容的分离，并且能扩充某个定义，达到重新定义其中所管理页面资源的目的。使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">JSP</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面直接定义管理版面的配置资源更为简单和灵活，同样可以和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一样重新定义网页的地址。不使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">JSP</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">框架页面而是直接在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">JSP</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面中使用配置页面，可以不用额外去定义管理文件，但缺点是无法重用这个页面定义的内容。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Tiles</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">CSS</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">结合起来，基本上能满足一般页面控制的需要。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 12pt">PlugIn</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">插件</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">通过继承</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionSerlvet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，重写它的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">init()</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，修改或增减它的初始化资源来达到改变</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">功能的方法，这从软件架构角度上来讲并不是一个好方法。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts1.1</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之后，可以通过</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">PlugIn</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口来实现动态增减</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">功能的目的。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">加载后，会执行实现</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">PlugIn</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口的类的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">init()</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">终止前，执行实现</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">PlugIn</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口的类的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">destroy()</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Tiles</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">就是利用这种方式来扩充</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">功能的。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 21.75pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">写到这里，感觉使用好</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Validator</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Tiles</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">PlugIn</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">插件最重要的就是对配置元素的理解，和程序调用流程的掌握，了解到</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的插件机制是如何运转的，以此来扩充</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Web</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用程序的功能，提供更好的用户体验。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P><img src ="http://www.blogjava.net/flyingis/aggbug/34272.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2006-03-08 14:52 <a href="http://www.blogjava.net/flyingis/archive/2006/03/08/34272.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重温Struts--Action</title><link>http://www.blogjava.net/flyingis/archive/2006/03/06/33778.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Sun, 05 Mar 2006 16:07:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2006/03/06/33778.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/33778.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2006/03/06/33778.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/33778.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/33778.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">作者：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><A HREF="/flyingis/" target=_blank><FONT color=#000080>Flyingis<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></A></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">担任分配工作的控制器角色，实际的工作是交给</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象来进行的。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">框架的核心类之一，它主要用来访问业务层、为表现层准备数据对象和处理错误异常。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">框架中基本上属于控制器的角色，通常不建议在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中加入过多的业务逻辑，将业务逻辑封装在其他的类中，然后在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中建立这些类的对象，调用对象的方法来实现业务功能。比较遗憾的是，当业务逻辑中出现异常的时候没有办法将异常说明在页面中直接反应出来，展现给用户，在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中控制这些异常可以做到这点。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要更详细的了解</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的工作机理，就要剖析</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控制器的工作流程及其核心方法。在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，担任控制器角色的核心是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，所有的请求都必须先通过它，而对所有请求的处理是交付给</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">RequestProcessor</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来完成的，既然处理请求的任务是交给</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">RequestProcessor</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来完成，那么可以直接查看</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">org.apche.struts.action.RequestProcessor</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类，看其</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">process()</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法实现了哪些功能，从源代码中的英文注释我们可以更深入了解到整个处理过程，很多书籍和网上不少文章都描述了这个过程，还有典型的处理过程图示，这里就不再详述。只是从这个过程可以看出，通过继承</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来定义自己的控制器请求意义不大，重写</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">init()</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法倒是可以修改初始化工作，如果需要定义自己的控制器，可以继承</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">RequestProcessor</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">并修改其中的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">process()</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法来实现。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用中，除了直接继承</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">org.apache.struts.action.Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类实现</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">功能外，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">还提供了其他几种</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类来满足某种特定需要，这些书本上已经写了很多，这里只是照葫芦画瓢略作总结：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN lang=EN-US style="FONT-SIZE: 10pt">ForwardAction—</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当需要从一个页面转到另一个页面或资源时，不提倡直接使用页面或资源路径调用，除了与</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">MVC/Model2</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">架构向背之外，有时还会带来其他的问题，前几天在网上看到一个帖子就是因为直接调用资源出现了异常，具体出自于哪里没有记住。这里，应该通过控制器使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ForwardAction</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来完成链接的跳转，使用属性</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">parameter</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设定</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">forward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的链接地址。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN lang=EN-US style="FONT-SIZE: 10pt">IncludeAction—</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ForwardAction</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类似，当需要引入一个资源时，可以使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">IncludeAction</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来实现，属性</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">parameter</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设定</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">include</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的链接地址。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN lang=EN-US style="FONT-SIZE: 10pt">SwitchAction—</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用于从一个模块转换至另一个模块，一种方法是使用相对于</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Context</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的路径来进行</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">forward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">查找，另外一种就是使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">SwithAction</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，它需要在请求中带两个参数，一个是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">prefix</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用来指定模块前缀名称，一个是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">page</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用来指定相对于模块的资源路径。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN lang=EN-US style="FONT-SIZE: 10pt">DispatchAction—</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">随着</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts Web</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用规模扩大，维护</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">复杂度提高，可以使用模块化来管理</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。另一方面，当一个页面需要多个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，我们就可以使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">DispatchAction</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来将一个页面中所有相关的动作放在一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类中实现，此时不需要重定义</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">execute()</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，它已经在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">DispatchAction</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">抽象类中定义，我们需要编写自己的方法来响应一个页面上不同的动作。它的关键属性是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">parameter</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 19.55pt; mso-para-margin-bottom: .5gd"><SPAN lang=EN-US style="FONT-SIZE: 10pt">LookupDispatchAction—</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">DispatchAction</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的子类，不同的是，当页面按钮的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">property</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性相同的时候，它可以通过查询资源文件来确定相应的动作，这个功能主要是通过重写</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">getKeyMethodMap()</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法实现的。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P><img src ="http://www.blogjava.net/flyingis/aggbug/33778.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2006-03-06 00:07 <a href="http://www.blogjava.net/flyingis/archive/2006/03/06/33778.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重温Struts--ActionMapping和ActionForward</title><link>http://www.blogjava.net/flyingis/archive/2006/03/05/33667.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Sun, 05 Mar 2006 02:40:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2006/03/05/33667.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/33667.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2006/03/05/33667.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/33667.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/33667.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 20pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">作者：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><A HREF="/flyingis/" target=_blank><FONT color=#000080>Flyingis<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></A></SPAN></P><SPAN lang=EN-US style="FONT-SIZE: 12pt">
<P style="MARGIN: 0cm 0cm 6pt; TEXT-INDENT: 20pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-left: 0cm"><SPAN style="FONT-SIZE: 10pt"><FONT face=宋体>前段时间用<SPAN lang=EN-US>Struts</SPAN>完成一个小项目，当时还没有来到<SPAN lang=EN-US>blogjava</SPAN>，很多东西也没有记录。现在花一点时间，将整个<SPAN lang=EN-US>Struts</SPAN>应用重新温习一遍，重新挖掘项目开发过程中没有注意到的知识点，并写下自己的一些心得与体会。<SPAN lang=EN-US><o:p></o:p></SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 6pt; TEXT-INDENT: 24.1pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-SIZE: 12pt"><STRONG>ActionMapping<o:p></o:p></STRONG></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 6pt; TEXT-INDENT: 20pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionMapping</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将对</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用中有效的业务逻辑进行分类，当一个请求到达时，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionSevlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionMapping</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录中查找对应的信息。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionMapping</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用的一个核心设计，当需要了解一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用，或编写一个新的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用的时候，都应该从</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionMapping</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">入手。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionMapping</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有较多的属性信息，具体参考相关文档。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 6pt; TEXT-INDENT: 24.1pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-SIZE: 12pt"><STRONG>ActionForward<o:p></o:p></STRONG></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 6pt; TEXT-INDENT: 20pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的核心类之一，其基类仅有</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">4</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个属性：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">name / path / redirect / classname</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。在基于</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Web</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用程序开发过程中，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">操作完毕后程序会通过</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的配置文件</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">struts-config.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">链接到指定的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，传到</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Struts</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的核心类</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionServlet</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供的路径，将控制传递给下一个步骤。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控制接下来程序的走向。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">代表一个应用的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">URI</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，它包括路径和参数，例如：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 6pt; TEXT-INDENT: 20pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-SIZE: 10pt">path=“/modify.do?method=edit&amp;id=<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:chmetcnv UnitName="”" SourceValue="10" HasSpace="False" Negative="False" NumberType="1" TCSC="0" w:st="on">10”</st1:chmetcnv><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 6pt; TEXT-INDENT: 20pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的参数除了在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">struts-config.xml</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和页面中设置外，还可以通过在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类中添加参数，或重新在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中创建一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 6pt; TEXT-INDENT: 20pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中有一个重要的属性</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">redirect</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，当</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">redirect=false</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，将保存存储在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">http</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">请求和请求上下文中的所有内容，仅在同一个应用中可用。当</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">redirect=true</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Web</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">客户端进行一次新的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">http</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">请求，请求的资源可以在同一个应用中，也可以不在，原来的请求参数不再保存，原来的请求上下文也被清除，新的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">http</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">请求仅包含</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">path</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性里所包含的参数。如果在同一个应用中，用户会话的上下文会被维护。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 6pt; TEXT-INDENT: 20pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-SIZE: 10pt">ActionForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分为全局转发和局部转发，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Action</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">Mapping</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">findForward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法首先会检查局部转发列表，查找失败就会到全局转发列表中查找。书写格式中，我们一般将全局变量定义为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt">String</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">常数，避免误解，使得转发列表结构清晰易读。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 7.8pt; TEXT-INDENT: 24.1pt; mso-para-margin-bottom: .5gd; mso-char-indent-count: 2.0"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">在项目开发过程中经常碰到一种情况，当页面已经改变了，浏览器中的地址如</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">/modify.do</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">或</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">/modify.jsp</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">却没有变化，当时没有考虑这么细，虽然存在疑问，但没有影响到程序功能的实现，因此忽略过去了，今天查找了一些资料才弄清楚。客户端浏览器显示的是浏览器最后被给定的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">URL</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">，当</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">URL</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">被提交后，在某个组件返回一个响应给浏览器之前，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Web</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">应用可能已经转发请求多次，而这些过程都发生在服务器端，客户端浏览器并不知道有什么变化。当一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">http</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">响应被返回时，它并没有包含地址栏的值，所以浏览器仅仅显示其用来作为初始请求的地址。通过使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">redirect</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">可以改变浏览器地址的显示，因为这样可以向浏览器提交一个新的请求，但付出的代价是数据不能通过请求上下文传递到页面，这也是使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">forward</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">redirect</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">的差异之一。</SPAN></SPAN></P><img src ="http://www.blogjava.net/flyingis/aggbug/33667.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2006-03-05 10:40 <a href="http://www.blogjava.net/flyingis/archive/2006/03/05/33667.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts Action的多种角色</title><link>http://www.blogjava.net/flyingis/archive/2005/11/18/20458.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Fri, 18 Nov 2005 09:10:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2005/11/18/20458.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/20458.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2005/11/18/20458.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/20458.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/20458.html</trackback:ping><description><![CDATA[<FONT size=2>&nbsp;&nbsp;&nbsp; 作者：<A HREF="/flyingis/"><FONT color=#000080>Flyingis</FONT></A><BR><BR>&nbsp;&nbsp;&nbsp; Action类是用户请求和业务逻辑之间的桥梁。每个Action充当用户的一项业务代理。在RequestProcessor类预处理请求时，在创建了Action的实例后，就调用自身的processActionPerform()方法，该方法再调用Action类的execute()方法。Action的execute()方法调用模型的业务方法，完成用户请求的业务逻辑，然后根据执行结果把请求转发给其他合适的Web组件。在实际的应用中，主要有以下几种比较常见的使用方法：<BR><BR>1.普通的Action应用<BR><BR>&lt;action path="/normalAction"<BR>type="package.OneActionClass"&gt;<BR>name="oneForm"<BR>input="page.jsp"<BR>&lt;forward name="success" path="success.jsp"/&gt;<BR>&lt;forward name="failure" path="failure.jsp"/&gt;<BR>&lt;/action&gt;<BR><BR>&nbsp;&nbsp;&nbsp; Struts的ActionServlet接收到一个请求，然后根据struts-config.xml的配置定位到相应的mapping（映射）；接下来如果form的范围是request或者在定义的范围中找不到这个form，创建一个新的form实例，如果找到则重用；取得form实例以后，调用其reset()方法，然后将表单中的参数放入form，如果validate属性不为false，调用validate()方法；如果validate()返回非空的ActionErrors，将会被转到input属性指定的URI，如果返回空的ActionErrors，那么执行Action的execute()方法，根据返回的ActionForward确定目标URI。即execute()仅当validate()成功以后才执行；input属性指定的是一个URI。<BR><BR><BR>2.有Form的Action应用<BR><BR>&lt;action path="/formAction"<BR>type="org.apache.struts.actions.ForwardAction"<BR>name="oneForm"<BR>input="page.jsp"<BR>parameter="another.jsp"<BR>/&gt;<BR><BR>&nbsp;&nbsp;&nbsp; Struts会在定义的scope搜寻oneForm，如果找到则重用，如果找不到则新建一个实例；取得form实例以后，调用其reset()方法，然后将表单中的参数放入form，如果validate属性不为false，调用validate()方法；如果validate()返回非空的ActionErrors，将会被转到input属性指定的URI，如果返回空的ActionErrors，那么转到parameter属性指定的目标URI。<BR><BR>&nbsp;&nbsp;&nbsp; 这种方法使得没有action类可以存放我们的业务逻辑，所以所有需要写入的逻辑都只能写到form的reset()或者validate()方法中。validate()的作用是验证和访问业务层。因为这里的action映射不包括forward，所以不能重定向，只能用默认的那个forward。这种仅有form的action可以用来处理数据获取并forward到另一个JSP来显示。<BR><BR><BR>3.仅有Action的Action应用<BR><BR>&lt;action path="/actionAction"<BR>type="package.OneActionClass"&gt;<BR>input="page.jsp"<BR>&lt;forward name="success" path="success.jsp"/&gt;<BR>&lt;forward name="failure" path="failure.jsp"/&gt;<BR>&lt;/action&gt;<BR><BR>&nbsp;&nbsp;&nbsp; ActionServlet接收到请求后，取得action类实例，调用execute()方法；然后根据返回的ActionForward在配置中找forward，forward到指定的URI或action。这样就没有form实例被传入execute()方法，于是execute()必须自己从请求中获取参数。Action可以被forward或者重定向。这种action不能处理通过HTML FORM提交的请求，只能处理链接式的请求。<BR><BR><BR>4.仅有JSP的Action应用<BR><BR>&lt;action path="/jspAction"<BR>type="org.apache.struts.actions.ForwardAction"<BR>parameter="another.jsp"<BR>/&gt;<BR><BR>&nbsp;&nbsp;&nbsp; ActionServlet接到请求后调用ForwardAction的execute()方法，execute()根据配置的parameter属性值来forward到那个URI。这种情况下，没有任何form被实例化，比较现实的情形可能是form在request更高级别的范围中定义；或者这个action被用作在应用程序编译好后充当系统参数，只需要更改这个配置文件而不需要重新编译系统。<BR><BR><BR>5.两个Action对应一个Form(和第四种方式部分的Action作用相近)<BR><BR>&lt;action path="/oneAction"<BR>type="package.OneActionClass"&gt;<BR>name="oneForm"<BR>input="one.jsp"<BR>&lt;forward name="success" path="/anotherAction.do"/&gt;<BR>&lt;/action&gt;<BR>&lt;action path="/anotherAction"<BR>type="package.AnotherActionClass"&gt;<BR>name="oneForm"<BR>input="another.jsp"<BR>&lt;forward name="success" path="success.jsp"/&gt;<BR>&lt;/action&gt;<BR><BR>&nbsp;&nbsp;&nbsp; 这个组合模式可以被用来传递form对象，就每个单独的action来讲，处理上并没有和完整的action有什么实质的区别。需要注意的是在后一个action中同样会调用form的reset()和validate()方法，因此我们必须确保form中的信息不被重写。这种情况分两种方式处理：a) 在request中放入一个指示器表明前一个action有意向后一个action传递form，从而在后一个action可以保留那个form中的值，这一方式只能在使用forward时使用。b) 当使用redirect而不是forward时，可以把指示器放在session或更高的级别，在命令链的最后一环将这个指示器清除。<BR><BR><BR>6.两个Action对应两个form<BR><BR>&lt;action path="/oneAction"<BR>type="package.oneActionClass"&gt;<BR>name="oneForm"<BR>input="one.jsp"<BR>&lt;forward name="successful" path="/anotherAction.do" redirect="true"/&gt;<BR>&lt;/action&gt;<BR>&lt;action path="/anotherAction"<BR>type="package.AnotherActionClass"&gt;"<BR>name="anotherForm"<BR>input="another.jsp"<BR>&lt;forward name="success" path="success.jsp"/&gt;<BR>&lt;/action&gt;<BR><BR>&nbsp;&nbsp;&nbsp; 这个组合方式跟前一种在流程上没有太大区别，只是我们现在对于两个action分别提供了form，于是代码看上去更加清晰。于是我们可以分别处理WEB应用程序的输入和输出。值得注意的是，后一个action同样会尝试往form中写入那些参数，不过我们可以这样处理：a) 在后一个form中使用另一套属性名；b) 只提供getter而不提供setter。<BR><BR>基本处理过程：<BR>&nbsp;&nbsp;&nbsp; 前一个action接收输入、验证、然后将数据写入业务层或持久层，重定向到后一个action，后一个action手动的从业务层/持久层取出数据，写入form（通过其他方式），交给前台JSP显示。这样做的好处是不必保留输入form中的值，因此可以使用redirect而不是forward。这样就降低了两个action之间的耦合度，同时也避免了不必要的重复提交。<BR><BR><FONT color=#0000ff>注明</FONT>：文中所提及的“仅有Form”指的是没有继承Struts提供的Action类，而是直接使用了Struts自身提供的Action类；“仅有Action”指的是仅继承了Struts提供的Action类而没有使用Form。</FONT><img src ="http://www.blogjava.net/flyingis/aggbug/20458.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2005-11-18 17:10 <a href="http://www.blogjava.net/flyingis/archive/2005/11/18/20458.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web开发2005年，情理之中、预料之外[转载]</title><link>http://www.blogjava.net/flyingis/archive/2005/11/17/20313.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Thu, 17 Nov 2005 13:49:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2005/11/17/20313.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/20313.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2005/11/17/20313.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/20313.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/20313.html</trackback:ping><description><![CDATA[
		<font size="2">
				<font color="#0000ff">(文章转自CSDN)<br /><br /></font>Web开发领域的2005年，一方面ASP.NET 2.0、PHP 5.1预期发布，另一方面Perl 6“已经开始看起来像个没有结束的项目了”，此外，Ajax和Ruby On Rails(简称RoR)的火爆让人嫉妒，这些现象的背后正是Web开发的理念悄然发生了变化。</font>
		<p>
				<font size="2">　　<strong>Web标准日渐流行</strong></font>
		</p>
		<p>
				<font size="2">　　当Jeffrey Zeldman在2003年出版《Designing With Web Standards》的时候，CSS已经被主流浏览器支持了4年之久。Web标准其实分三方面:结构化标准语言主要包括XHTML和XML，表现标准语言主要包括CSS，行为标准主要包括对象模型(如W3C DOM)、ECMAScript等。他的的主要好处在于缩小了页面大小、布局更加随意、也有利于页面和代码的分离，正是这些好处让微软MSN、网易、阿里巴巴和CSDN等网站在2005年陆续按照Web标准进行了重构。</font>
		</p>
		<p>
				<font size="2">　　<strong>Ajax:用户体验型的富客户端技术</strong></font>
		</p>
		<p>
				<font size="2">　　用过微软Live服务的用户都为网络程序能随意拖动和放置页面栏目、无刷新更新网页数据、渐变的颜色处理感到吃惊，这些“酷”的技术被冠名为Ajax，这项技术最早由Google应用在GoogleMap和GoogleMail中，其实Ajax并不神奇，原理是通过调用XmlHttpRequest实现与服务器的异步通讯，并使用对应平台的XmlDom对返回的Xml消息进行处理，然后再通过DOM对页面中的HTML元素的操作实现丰富的、友好的用户界面。这和当初微软推广的Remote Scripting几乎如出一辙。不过，和当初不同的事，这项技术得到了足够的重视，相关开发包源源不断，成为2005最具亮丽的一道风景线，微软也耐不住寂寞，即将推出Atlas就是用来帮助开发者更容易地构建Ajax站点。Ajax的风行说明用户对于丰富的Web体验的需求日益增长，这种趋势不可逆转。</font>
		</p>
		<p>
				<font size="2">　　<strong>RoR预示轻型开发框架的流行</strong></font>
		</p>
		<p>
				<font size="2">　　RoR是基于Ruby语言的轻型Web开发框架，不仅开发效率高(部署容易)、功能丰富(支持Ajax等流行应用) ，不可思议的是，他的性能比基于Struts和Hibernate的Java应用还高15%-30%。目前，其他语言也已经有类似的框架，如基于Python的Django、PHP的Cake、ASP.NET的Castle等等。Web应用特点是需求变化非常快，Rails提倡的“约定强于配置”的理念正好迎合了这种发展潮流。不过，使用RoR的大型网站还不多见，是否经得起考验，还看2006年。</font>
		</p>
		<p>
				<font size="2">　　Web开发的2005年，我们还应当关注的是：</font>
		</p>
		<p>
				<font size="2">　　<strong>ASP.NET 2.0随NET Framework 2.0发布</strong></font>
		</p>
		<p>
				<font size="2">　　每个ASP.NET程序员需要关注的产品。虽然不是一个革命性的升级，很多新特性还是足够让开发者心动。有了2.0，谁还愿意使用1.x?微软的产品总是让人对他产生依赖。</font>
		</p>
		<p>
				<font size="2">　　<strong>Jdon Framework</strong></font>
		</p>
		<p>
				<font size="2">　　这个由国人彭晨阳开发的中小型J2EE应用系统的快速开发框架已经发布了1.3版本，和RoR类似，Jdon框架中, Action的CRUD功能实现是由配置文件实现的，一般情况下无需编码。支持日本的Ruby，不如支持中国的Jdon，你们觉得呢?</font>
		</p>
<img src ="http://www.blogjava.net/flyingis/aggbug/20313.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2005-11-17 21:49 <a href="http://www.blogjava.net/flyingis/archive/2005/11/17/20313.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JSF VS Tapestry 全面比较</title><link>http://www.blogjava.net/flyingis/archive/2005/11/09/18962.html</link><dc:creator>Flyingis</dc:creator><author>Flyingis</author><pubDate>Wed, 09 Nov 2005 05:08:00 GMT</pubDate><guid>http://www.blogjava.net/flyingis/archive/2005/11/09/18962.html</guid><wfw:comment>http://www.blogjava.net/flyingis/comments/18962.html</wfw:comment><comments>http://www.blogjava.net/flyingis/archive/2005/11/09/18962.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/flyingis/comments/commentRss/18962.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/flyingis/services/trackbacks/18962.html</trackback:ping><description><![CDATA[
		<font size="2">    作者：<a href="/flyingis/"><font color="#000080">Flyingis</font></a><br /><br />    Java不像微软拥有Visual Studio 2005，各个开发组件无缝整合，提供高效的开发与部署环境。开发环境、插件和工具的多样化，给Java开发者带来了一些麻烦，但是却换来了极大的灵活性和选择的空间。Eclipse已经逐渐成为业界首选的开发环境，给Borland等公司带来不少的冲击，使得老牌的Java IDE公司的市场份额逐渐丢失，而在应用服务器、对象关系数据中间件、报表中间件、Web开发框架等领域仍然是热闹非凡，选择众多。<br /><br />    Java Web开发框架主要有Struts/JSF/Tapestry/WebWork/Spring等，它们都非常优秀，有自己的优点与不足，对于我们开发者而言，只选对的，适合项目需求的才是最重要的。这里有一篇文章介绍了JSF和Tapestry之间的相似之处与不同点，可以让我们更好的认识到它们之中哪种框架更适合你。<br /><br /><a href="http://news.csdn.net/news/newstopic/28/28929.shtml" target="_blank">JSF VS Tapestry 全面比较(一)</a><br /><a href="http://news.csdn.net/news/newstopic/28/28930.shtml" target="_blank">JSF VS Tapestry 全面比较(二)</a><br /><a href="http://news.csdn.net/news/newstopic/28/28931.shtml" target="_blank">JSF VS Tapestry 全面比较(三)</a></font>
<img src ="http://www.blogjava.net/flyingis/aggbug/18962.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/flyingis/" target="_blank">Flyingis</a> 2005-11-09 13:08 <a href="http://www.blogjava.net/flyingis/archive/2005/11/09/18962.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>