??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲日韩欧洲乱码AV夜夜摸,精品亚洲成A人在线观看青青,亚洲色欲色欲wwwhttp://www.tkk7.com/soochow_hhb/category/1422.html<style> #glowtext{ filter:glow(color=green,strength=2);width:100%; } </style> <span id="glowtext"> <script language="JavaScript1.2"> var message=" h丰富知识和经验的人,比只有一U知识和l验的h更容易生新的联惛_独到的见解? var neonbasecolor="#FF930D" var neontextcolor="#00B3FD" var flashspeed=300 //in milliseconds var n=0 if (document.all){ document.write('<font color="'+neonbasecolor+'">') for (m=0;m<message.length;m++) document.write('<span id="neonlight" class="content">'+message.charAt(m)+'</span>') document.write('</font>') //cache reference to neonlight array var tempref=document.all.neonlight } else document.write(message) function neon(){ //Change all letters to base color if (n==0){ for (m=0;m<message.length;m++) tempref[m].style.color=neonbasecolor } //cycle through and change individual letters to neon color tempref[n].style.color=neontextcolor if (n<tempref.length-1) n++ else{ n=0 clearInterval(flashing) setTimeout("beginneon()",1500) return } } function beginneon(){ if (document.all) flashing=setInterval("neon()",flashspeed) } beginneon() </script> </span>zh-cnTue, 27 Feb 2007 11:05:55 GMTTue, 27 Feb 2007 11:05:55 GMT60jsp-java-mysql字符集统一http://www.tkk7.com/soochow_hhb/archive/2006/11/03/78845.htmlsoochow_hhb 以java论成?以架构论英雄soochow_hhb 以java论成?以架构论英雄Fri, 03 Nov 2006 01:03:00 GMThttp://www.tkk7.com/soochow_hhb/archive/2006/11/03/78845.htmlhttp://www.tkk7.com/soochow_hhb/comments/78845.htmlhttp://www.tkk7.com/soochow_hhb/archive/2006/11/03/78845.html#Feedback0http://www.tkk7.com/soochow_hhb/comments/commentRss/78845.htmlhttp://www.tkk7.com/soochow_hhb/services/trackbacks/78845.html2、在java中,从jsp提交q来的数据是gbk~码的,而java默认的处理方式是使用ISO-8859-1~码Q所以若在java中能昄jsp提交q来的gbk~码方式的数据,pq行一个{换:gbk转换为ISO-8859-1Q这h据就可正常显C?br />3、如果要jsp提交的数据经qjava后台处理Q然后放入数据库中,又多了一个数据编码方式:数据库的数据~码方式。以mysqlZQ默认字W集为latinQ所以若gbk的数据放入,必然出现qQ所以首先应改变数据库的~码方式为gbk?br />
lgQ简单的讄Ҏ如下Q?br />
jsp (gbk)     ---->     java(ISO-8859-1)  -------> mysql(gbk)
                                                                转换
q样讄之后Q还有一U情况会出现qQ当你在jsp端提交一个idP然后在java处理端通过id号得到数据库中的gbkQ汉字)数据Q这是就会出Cؕ码,因ؓjava处理的是ISO-8859-1Q你在java到mysql中有了一个ISO-8859-1到gbk的{换,而这些数据本w就是ISO-8859-1,所以{换后出现问题了?br />解决办法Q将在java中处理的gbk数据转换为ISO-8859-1卛_?br />
MQ在jspQjavaQmysql三者之间的~码方式必须l一Q不能错误的转换或者不转换?img src ="http://www.tkk7.com/soochow_hhb/aggbug/78845.html" width = "1" height = "1" />

soochow_hhb 以java论成?以架构论英雄 2006-11-03 09:03 发表评论
]]>
IoC的初步理?/title><link>http://www.tkk7.com/soochow_hhb/archive/2006/09/30/72966.html</link><dc:creator>soochow_hhb 以java论成?以架构论英雄</dc:creator><author>soochow_hhb 以java论成?以架构论英雄</author><pubDate>Sat, 30 Sep 2006 02:37:00 GMT</pubDate><guid>http://www.tkk7.com/soochow_hhb/archive/2006/09/30/72966.html</guid><wfw:comment>http://www.tkk7.com/soochow_hhb/comments/72966.html</wfw:comment><comments>http://www.tkk7.com/soochow_hhb/archive/2006/09/30/72966.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.tkk7.com/soochow_hhb/comments/commentRss/72966.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/soochow_hhb/services/trackbacks/72966.html</trackback:ping><description><![CDATA[ <p>好久写有关java技术的文章了,q几天在图书馆看到《Spring in Action》就借过来随手翻,觉得W一章的IoC的概念讲的很好,现在整理如下?br /><font style="BACKGROUND-COLOR: #ffffff" color="#a52a2a"><strong>Q?Q从cȝ耦合说v<br /></strong></font>在实际的pȝ中,要多个类共同协作来完成某一Q务,一般称为复合。在pȝ的设计过E中Q耦合是不可避免的Q是必须的,但是它会带来以下问题Q?br />Q-难以试Q看下面的两个类Q?br />KnightOfTheRoundTable<br />                  |<br />                  |  new<br />                 V<br />         HolyGrailQuest<br />在KnightOfTheRoundTablecM使用了HolyGrailQuestc,q且可能使用不同的QuestcR这两个cȝ功能是骑士去执行不同的Q务,HolyGrail只是代表了一UQ务。这U通过国new的方式,使得knight和quest两个cȝ密的耦合在一赗设计完成后做单元测试,看下面的代码Q?br />KnightOfTheRoundTable knight = new KnightOfTheRoundTable("Bedivere");<br />HolyGrail grail = knight.embarkOnQuery();<br />assertNotNull(grail);<br />assertTrue(grail.isHoly());<br />在测试KnightOfTheRoundTablecȝ时候,间接的测试了HolyGrailQuestc,但是对于HolyGrailQuestcȝ情况q没有很昑ּ的测试,所以用了最后的两行代码来测试,昑־很笨拙。不知道是否试了所有可能的情况?br />Q-难以l护<br />如果以后修改了代码,或者增加了/改变了knight的Q务,代码必须改动Q测试代码也要改动,q且改动一个地方,可能会媄响到其他很多地方Qؓ日后的维护工作带来了ȝ<br />Q-紧耦合<br />提示Q这U模式引L问题Q主要是因ؓ紧耦合所_所以要解决q种问题的首要方案就是解耦合Q但如何来解耦合呢?Ll看Q?br /><font color="#a52a2a"><strong>Q?Q解耦合——通过接口interface来实?br /></strong></font>因ؓ骑士可能执行不同的Q务,也有不同U类的骑士,所以我们可以将d和骑士抽象ؓ接口Q将具体的实现隐藏在接口之下Q这样就不必在knightcM通过昄?HolyGrailQuest quest = new HolyGrailQuest ()q样的语句来创徏Quest对象Q而可以通过接口Quest quest Q?new HolyGrailQuest()来实现。这样就形成了如下的cdQ?br /><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><img src="http://www.tkk7.com/images/blogjava_net/soochow_hhb/1228/r_.bmp" /></span></p> <p> <span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">q样Q虽然用了接口Q得层ơ分明,通过接口Quest来实现探险,但是q是只能从事一U探险Q务,而如何才能让骑士从事M一UQ务呢Q请l箋看!<br /><font color="#a52a2a"><strong>Q?Q给予与获得</strong></font><br />骑士执行探险d有两U方式:<br />W一、让骑士d获得探险dQ前面的实现方式属于q类Q通过new来实玎ͼ<br />W二Q让骑士被动的获得Q务,即给予骑士某Ҏ险Q务,q样p决了上面的问题(让骑士可以从事Q何一UQ务,只要l他们分配即可)?br />实际实现的方式很单,看如下代码:<br />public void setQuest(Quest quest){<br />   this.quest = quest;<br />}<br /><font color="#0000ff"><strong>单的代码实现了方式的改变Q这LKnightOfTheRoundTablecM入Q何的QuestdQ都可以接受了?br />到这里可以很明显的看出来Q我们将以前的new方式Q翻转过来,即不是让d获得依赖c,而是被动的获得依赖类Q这是IoC的核心,实际Fowler说得依赖注入也很贴切Q即向类中“注入”它依赖的其他类?br /></strong></font><br />好了Q到q里Q应该知道了IoC的基本概念了吧,也知道了IoC的基本功能了吧?br />要想更深入的了解Q请x我的文章?/span> </p> <img src ="http://www.tkk7.com/soochow_hhb/aggbug/72966.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/soochow_hhb/" target="_blank">soochow_hhb 以java论成?以架构论英雄</a> 2006-09-30 10:37 <a href="http://www.tkk7.com/soochow_hhb/archive/2006/09/30/72966.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>软g新技术课的作?http://www.tkk7.com/soochow_hhb/archive/2005/06/13/6051.htmlsoochow_hhb 以java论成?以架构论英雄soochow_hhb 以java论成?以架构论英雄Mon, 13 Jun 2005 08:23:00 GMThttp://www.tkk7.com/soochow_hhb/archive/2005/06/13/6051.htmlhttp://www.tkk7.com/soochow_hhb/comments/6051.htmlhttp://www.tkk7.com/soochow_hhb/archive/2005/06/13/6051.html#Feedback2http://www.tkk7.com/soochow_hhb/comments/commentRss/6051.htmlhttp://www.tkk7.com/soochow_hhb/services/trackbacks/6051.html
Ƣ迎交流Q?A href="http://www.tkk7.com/Files/soochow_hhb/从开源项目看软g技?rar">下蝲

soochow_hhb 以java论成?以架构论英雄 2005-06-13 16:23 发表评论
]]>
使用Tiles和Struts设计web界面http://www.tkk7.com/soochow_hhb/archive/2005/06/13/5627.htmlsoochow_hhb 以java论成?以架构论英雄soochow_hhb 以java论成?以架构论英雄Mon, 13 Jun 2005 08:11:00 GMThttp://www.tkk7.com/soochow_hhb/archive/2005/06/13/5627.htmlhttp://www.tkk7.com/soochow_hhb/comments/5627.htmlhttp://www.tkk7.com/soochow_hhb/archive/2005/06/13/5627.html#Feedback1http://www.tkk7.com/soochow_hhb/comments/commentRss/5627.htmlhttp://www.tkk7.com/soochow_hhb/services/trackbacks/5627.html阅读全文

soochow_hhb 以java论成?以架构论英雄 2005-06-13 16:11 发表评论
]]>
Strus常见错误及原因分?/title><link>http://www.tkk7.com/soochow_hhb/archive/2005/06/11/5905.html</link><dc:creator>soochow_hhb 以java论成?以架构论英雄</dc:creator><author>soochow_hhb 以java论成?以架构论英雄</author><pubDate>Sat, 11 Jun 2005 03:58:00 GMT</pubDate><guid>http://www.tkk7.com/soochow_hhb/archive/2005/06/11/5905.html</guid><wfw:comment>http://www.tkk7.com/soochow_hhb/comments/5905.html</wfw:comment><comments>http://www.tkk7.com/soochow_hhb/archive/2005/06/11/5905.html#Feedback</comments><slash:comments>16</slash:comments><wfw:commentRss>http://www.tkk7.com/soochow_hhb/comments/commentRss/5905.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/soochow_hhb/services/trackbacks/5905.html</trackback:ping><description><![CDATA[     摘要: 本篇文章包含了在用Struts开发web应用时经常碰到的一些异常和错误Q根据异常或错误信息本nQ经常可以找到潜在的错误发生原因?下面列出了一些Struts的常见错误和异常Qƈl出了一些可能发生此c错误或异常的原因。有的后面有相关q接Q你可以通过它找到更多的信息? Cannot retrieve mapping for action 异常 javax.s...  <a href='http://www.tkk7.com/soochow_hhb/archive/2005/06/11/5905.html'>阅读全文</a><img src ="http://www.tkk7.com/soochow_hhb/aggbug/5905.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/soochow_hhb/" target="_blank">soochow_hhb 以java论成?以架构论英雄</a> 2005-06-11 11:58 <a href="http://www.tkk7.com/soochow_hhb/archive/2005/06/11/5905.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts vs webwork 中文http://www.tkk7.com/soochow_hhb/archive/2005/05/29/5311.htmlsoochow_hhb 以java论成?以架构论英雄soochow_hhb 以java论成?以架构论英雄Sun, 29 May 2005 06:16:00 GMThttp://www.tkk7.com/soochow_hhb/archive/2005/05/29/5311.htmlhttp://www.tkk7.com/soochow_hhb/comments/5311.htmlhttp://www.tkk7.com/soochow_hhb/archive/2005/05/29/5311.html#Feedback1http://www.tkk7.com/soochow_hhb/comments/commentRss/5311.htmlhttp://www.tkk7.com/soochow_hhb/services/trackbacks/5311.htmlmoxie的《WebWork教程Q?.90版?BR>Ƣ迎一h讨WEB Framework?A href="http://www.tkk7.com/soochow_hhb/">http://www.tkk7.com/soochow_hhb/ 

?/SPAN> ?/SPAN>

Struts1.1

WebWork2

Actionc?/SPAN>

?/SPAN>Struts里面Q每一?/SPAN>Actioncd需要承一个抽象的c?/SPAN>org.apache.struts.action.Action。这个在Java~程中会引来一些问题,是关于多种l承的问题?/SPAN>

WebWork?/SPAN>ActioncM需要实现接?/SPAN>com.opensymphony.xwork.ActionQ也可以实现其它的接口来实现更多的功能,譬如Q?/SPAN>validateQ验证)Q?/SPAN>localware(国际?/SPAN>){。当Ӟ它也提供了一个类ActionSupport集成了上面的所有功能,我们在开发中可以Ҏ需要选择?/SPAN>

U程模型

Struts ?/SPAN>Action必需?/SPAN>threadQ?/SPAN>safe方式Q它仅仅允许一个实例去处理所有的h。所?/SPAN>action用到的所有的资源都必需l一同步Q这个就引v了线E安全的问题?/SPAN>

?/SPAN>WebWork中,每个h对应一?/SPAN>ActionQ因此没有线E的安全问题。实际上Servlet容器Ҏ个请求也产生多个对象Q它也没有证明对性能和垃圑֛收生太多的影响?/SPAN>

Servlet的依?/SPAN>

Struts处理Action时必需要依?/SPAN>ServletRequest ?/SPAN>ServletResponseQ所有它摆脱不了Servlet容器?/SPAN>

WebWork?/SPAN>Action不用依赖Web层和其它的容器。它可以通过ActionContextQ直接去讉KRequest?/SPAN>ResponseQ但q个是可选的Q只有在必需的请求下使用?/SPAN>

Struts的每?/SPAN>Action都同Web层耦合在一Pq样它的试依赖?/SPAN>Web容器Q单元测试也很难实现。不q有一?/SPAN>Junit的扩展工?/SPAN>Struts TestCase可以实现它的单元试?/SPAN>

Webwork?/SPAN>action能够通过赋予一定的属性,可以执行单元测试。同时也可以使用一?/SPAN>mock的实例去试Q而不是通过启动web容器来进行测试?/SPAN>

FormBean

Struts要求?/SPAN>FormBean对应每一个表单,而且FormBean必需l承抽象c?/SPAN>ActionForm。而?/SPAN>DynaBeans实际上没有太大的意义。不能够很好的处理现有的模型?/SPAN>

Webwork 能够动态的攉web的数据然后再赋值给bean。它也可以?/SPAN>FormBean的Ş式,FormBean可以是普通的DTO和域对象Q它不用重新Ҏ域对象来生成新的FormBeanQ也不需l承抽象c?/SPAN>ActionForm?/SPAN>

前端表达式语a

Struts集成?/SPAN>JSTLQ所以它主要使用JSTL的表辑ּ语言来获取数据。可?/SPAN>JSTL的表辑ּ语言?/SPAN>Collection和烦引属性方面处理显得很弱?/SPAN>

WebWork的表辑ּ语言使用了功能强大的OGNL。它使用OGNL建立一?/SPAN>OgnlValueStack来搜索数据?/SPAN>Webwork前端也可以?/SPAN>JSTLQ但它同时支持:velocity?/SPAN>freemaker?/SPAN>jspparer?/SPAN>xml?/SPAN>

cd的{?/SPAN>

Struts?/SPAN>FormBean把所有的数据都作?/SPAN>StringcdQ它可以使用工具Commons-Beanutilsq行cd转化。但它的转化都是?/SPAN>ClassU别Q而且转化的类型是不可配置的。类型{化时的错误信息返回给用户也是非常困难的?/SPAN>

WebWork使用OGNLq行cd转化Q提供了所有基本类型的转化功能。类型{化可以直接对一?/SPAN>Classq行Q?/SPAN>ClassU别Q{化,也可以对Class的字D进行类型{化。它使用拦截器可以很Ҏ的将cd转化的错误信息返回给用户Q而且错误信息可以对应C个相应的字段?/SPAN>

?/SPAN>Action 执行前和后的处理

Struts处理Action的时候是Zclass?/SPAN>hierarchiesQ很隑֜action处理前和后进行操作?/SPAN>

Webwork2 允许您处?/SPAN>Action可以通过拦截器,是在每一?/SPAN>Action处理前或者后q行其它操作。它的拦截器可以在配|文件中动态添加,q样Action和拦截器之间完全解藕Q更好的实现了组件化?/SPAN>

验证处理

Struts的验证是调用FormBean?/SPAN>validator()ҎQ其实就是对FormBean的验证。它一般用框?/SPAN>Commons Validationq行数据验证处理。它使用了一个全局的配|文?/SPAN>validation.xml定义?/SPAN>FormBean的验证信息?/SPAN>Struts?/SPAN>FormBean属性都被认为是StringcdQ所以它在验证时也需要额外的cd转化?/SPAN>

WebWork使用Xwork的验证框架进行验证处理,它可以通过配置拦截器来ȀzR它可以为每个需要验证的Class指定一?/SPAN>xml验证文gQ也可以Z?/SPAN>Class在不同的情况指定不同?/SPAN>xml验证文g?/SPAN>WebWork证可以给每个ActioncL定对应的验证文gQ也可以l?/SPAN>Action的字D去指定验证文g。通过拦截器来l装Action和其验证文gQ它们之间完全解藕?/SPAN>

?/SPAN>Action执行的控?/SPAN>

Struts创徏一?/SPAN>ActionQ如果想控制它的执行序会非常困难。甚至你要重新去?/SPAN>Servlet来实C的这个功能需求?/SPAN>

在这个方面,WebWork的拦截器栈提供了强大的功能?/SPAN>Action的所有切面功能都有拦截器来实玎ͼ比如Q取?/SPAN>requesth参数、验证处理等Q,q样你就可以用拦截器栈来l织拦截器的执行序。例如:你需要在使用requesth参数来设|?/SPAN>Action属性之前,使用IoC框架讄Action的属性,反之已然。这Ӟ你就可以?/SPAN>package?/SPAN>Action指定一个拦截器栈来实现?/SPAN>



soochow_hhb 以java论成?以架构论英雄 2005-05-29 14:16 发表评论
]]>
Sturts vs WebWorkhttp://www.tkk7.com/soochow_hhb/archive/2005/05/27/5267.htmlsoochow_hhb 以java论成?以架构论英雄soochow_hhb 以java论成?以架构论英雄Fri, 27 May 2005 06:38:00 GMThttp://www.tkk7.com/soochow_hhb/archive/2005/05/27/5267.htmlhttp://www.tkk7.com/soochow_hhb/comments/5267.htmlhttp://www.tkk7.com/soochow_hhb/archive/2005/05/27/5267.html#Feedback0http://www.tkk7.com/soochow_hhb/comments/commentRss/5267.htmlhttp://www.tkk7.com/soochow_hhb/services/trackbacks/5267.htmlhttp://www.opensymphony.com/webwork/wikidocs/Comparison%20to%20Struts.html|站对Struts和WebWork的比较?BR>

Feature

Struts

WebWork 1.x

WebWork 2.x

Action classes

Struts requires Action classes to extend an Abstract base class. This shows a common problem in Struts of programming to abstract classes instead of interfaces.

Action classes must implement the webwork.Action Interface. There are other Interfaces which can be implemented for other services, such as storing error messages, getting localized texts, etc. The ActionSupport class implements many of these Interfaces and can act as a base class. WebWork is all written to Interfaces, which allows for plugging in your own implementations.

An Action must implement the com.opensymphony.xwork.Action Interface, with a series of other Interfaces for other services, like in WebWork 1.x. WebWork2 has its own ActionSupport to implement these Interfaces.

Threading Model

Struts Actions must be thread-safe because there will only be one instance to handle all requests. This places restrictions on what can be done with Struts Actions as any resources held must be thread-safe or access to them must be synchronized.

WebWork Actions are instantiated for each request, so there are no thread-safety issues. In practice, Servlet containers generate many throw-away objects per request, and one more Object does not prove to be a problem for performance or garbage collection.

ditto

Servlet Dependency

Struts Actions have dependencies on Servlets because they get the ServletRequest and ServletResponse (not HttpServletRequest and HttpServletResponse, I've been told) when they are executed. This tie to Servlets (although not Http*) is a defacto tie to a Servlet container, which is an unneeded dependency. Servlets may be used outside a Web context, but it's not a good fit for JMS, for instance.

WebWork Actions are not tied to the web or any container. WebWork actions CAN choose to access the request and response from the ActionContext, but it is not required and should be done only when ABSOLUTELY neccessary to avoid tieing code to the Web.

ditto

Testability

Many strategies have sprung up around testing Struts applications, but the major hurdle is the fact that Struts Actions are so tightly tied to the web (receiving a Request and Response object). This often leads people to test Struts Actions inside a container, which is both slow and NOT UNIT TESTING. There is a Junit extension : Struts TestCase (http://strutstestcase.sourceforge.net/)

WebWork actions can be tested by instantiating your action, setting the properties, and executing them

ditto, but the emphasis on Inversion of Control makes testing even simpler, as you can just set a Mock implementation of your services into your Action for testing, instead of having to set up service registries or static singletons

FormBeans

Struts requires the use of FormBeans for every form, necessitating either a lot of extra classes or the use of DynaBeans, which are really just a workaround for the limitation of requiring FormBeans

WebWork 1.x allows you to have all of your properties directly accessible on your Action as regular Javabeans properties, including rich Object types which can have their own properties which can be accessed from the web page. WebWork also allows the FormBean pattern, as discussed in "WW1:Populate Form Bean and access its value"

WebWork 2 allows the same features as WebWork 1, but adds ModelDriven Actions, which allow you to have a rich Object type or domain object as your form bean, with its properties directly accessible to the web page, rather than accessing them as sub-properties of a property of the Action.

Expression Language

Struts 1.1 integrates with JSTL, so it uses the JSTL EL. This EL has basic object graph traversal, but relatively weak collection and indexed property support.

WebWork 1.x has its own Expression language which is built for accessing the ValueStack. Collection and indexed property support are basic but good. WebWork can also be made to work directly with JSTL using the Filter described in WW1:Using JSTL seamlessly with WebWork

WebWork 2 uses XW:Ognl which is a VERY powerful expression language, with additions for accessing the value stack. Ognl supports very powerful collection and indexed property support. Ognl also supports powerful features like projections (calling the same method on each member of a collection and building a new collection of the results), selections (filtering a collection with a selector expression to return a subset), list construction, and lambda expressions (simple functions which can be reused). Ognl also allows access to static methods, static fields, and constructors of classes. WebWork2 may also use JSTL as mentioned in WW1:Using JSTL seamlessly with WebWork

Binding values into views

Struts uses the standard JSP mechanism for binding objects into the page context for access, which tightly couples your view to the form beans being rendered

WebWork sets up a ValueStack which the WebWork taglibs access to dynamically find values very flexibly without tightly coupling your view to the types it is rendering. This allows you to reuse views across a range of types which have the same properties.

ditto

Type Conversion

Struts FormBeans properties are usually all Strings. Struts uses Commons-Beanutils for type conversion. Converters are per-class, and not configurable per instance. Getting a meaningful type conversion error out and displaying it to the user can be difficult.

WebWork 1.x uses PropertyEditors for type conversion. PropertyEditors are per type and not settable per Action, but field error messages are added to the field error map in the Action to be automatically displayed to the user with the field.

WebWork2 uses Ognl for type conversion with added converters provided for all basic types. Type converters default to these converters, but type conversion can be specified per field per class. Type conversion errors also have a default error message but can be set per field per class using the localization mechanism in WW2 and will be set into the field error messages of the Action.

Modular Before & After Processing

Class hierarchies of base Actions must be built up to do processing before and after delegating to the Action classes, which can lead deep class hierarchies and limitations due to the inability to have multiple inheritance WW:Comparison to Struts#1

Class hierarchies

WebWork 2 allows you to modularize before and after processing in Interceptors. Interceptors can be applied dynamically via the configuration without any coupling between the Action classes and the Interceptors.

Validation

Struts calls validate() on the FormBean. Struts users often use Commons Validation for validation. I don't know a lot about this, so I'll put some questions here:
 
Because FormBean properties are usually Strings, some types of validations must either be duplicated (checking type conversion) or cannot be done?
 
Can Commons Validation have different validation contexts for the same class? (I've been told yes, so that's a good thing)
 
Can Commons Validation chain to validations on sub-objects, using the validations defined for that object properties class?

WebWork1.x calls the validate() method on Actions, which can either do programmatic validations or call an outside validation framework (this is apparently the same as Struts)

WebWork2 can use the validate() method of WebWork and Struts and / or use the XW:Validation Framework, which is activated using an XWork Interceptor. The Xwork Validation Framework allows you to define validations in an XML format with default validations for a class and custom validations added for different validation contexts. The Xwork Validation Framework is enabled via an Interceptor and is therefore completely decoupled from your Action class. The Xwork Validation Framework also allows you to chain the validation process down into sub-properties using the VisitorFieldValidator which will use the validations defined for the properties class type and the validation context.

Control Of Action Execution

As far as I know Struts sets up the Action object for you, and you have very little control over the order of operations. To change them I think you need to write your own Servlet to handle dispatching as you want

The ActionFactory chain controls the order in which an Action is constructed and initialised, but this requires writing a class

The interceptor stacks in WebWork 2 are hugely powerful in this regard. All aspects of Action setup have been moved into Interceptor implementations (ie setting paramters from the web, validation etc), so you can control on a per action basis the order in which they are performed. For example you might want your IOC framework to setup the action before the parameters are set from the request or vice versa - you can thusly control this on a per package or per action basis with interceptor stacks.



soochow_hhb 以java论成?以架构论英雄 2005-05-27 14:38 发表评论
]]>
目前行Web Framework比较和思?/title><link>http://www.tkk7.com/soochow_hhb/archive/2005/05/27/5257.html</link><dc:creator>soochow_hhb 以java论成?以架构论英雄</dc:creator><author>soochow_hhb 以java论成?以架构论英雄</author><pubDate>Fri, 27 May 2005 03:18:00 GMT</pubDate><guid>http://www.tkk7.com/soochow_hhb/archive/2005/05/27/5257.html</guid><wfw:comment>http://www.tkk7.com/soochow_hhb/comments/5257.html</wfw:comment><comments>http://www.tkk7.com/soochow_hhb/archive/2005/05/27/5257.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.tkk7.com/soochow_hhb/comments/commentRss/5257.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/soochow_hhb/services/trackbacks/5257.html</trackback:ping><description><![CDATA[<P align=left>从国外网站上看到一文章,转发q来Q附单注解。原文在<A >http://raibledesigns.com/page/rd/sunsets?catname=%2FJava</A> <BR>I updated my Web Framework Comparison presentation today. Rather than updating the graph that shows today's job availability, I did one that compares today to 6 months ago. Struts is still the clear winner (and growing). Spring is definitely growing. Tapestry has about the same amount of jobs (9 vs. 8). WebWork lost 10 opening (down to 4) and the demand for JSF skills has grown as well.<BR><BR><FONT style="BACKGROUND-COLOR: #ffa500"><FONT style="BACKGROUND-COLOR: #ffffff" color=#0000ff>Struts明显是最大的赢家Qƈ且持l增长,Spring明显的有所增长QTspestry基本持^QWebWorks下降?QJSF的需求有所增长?/FONT></FONT><BR minmax_bound="true"><BR minmax_bound="true">Is WebWork a dying framework? I've heard folks complain about its small community, and there <EM minmax_bound="true">still</EM> <SPAN style="TEXT-DECORATION: line-through" minmax_bound="true">aren't any books</SPAN> is only <A minmax_bound="true"><STRONG><FONT color=#cc3300>one book</FONT></STRONG></A> about it. <EM minmax_bound="true">Is that a jab at Patrick, Jason and Kris - or a jab at Manning? I'm not sure.</EM> <IMG class=smiley title=;-) alt=;-) src="http://raibledesigns.com/images/smileys/wink.gif" minmax_bound="true"> The good news is <A minmax_bound="true"><STRONG><FONT color=#cc3300>WebWork in Action</FONT></STRONG></A> and <A minmax_bound="true"><STRONG><FONT color=#cc3300>WebWork Live</FONT></STRONG></A> should both be out this summer.<BR><BR><BR></P> <P align=center><IMG height=394 alt=o_webframeworkjobs-May2005.gif src="http://www.tkk7.com/images/blogjava_net/soochow_hhb/1228/o_webframeworkjobs-May2005.gif" width=572 border=0></P> <P align=left><BR></P> <P minmax_bound="true">My search criteria for all of these was "<EM minmax_bound="true">framework</EM> and java" from the front page on <A minmax_bound="true"><STRONG><FONT color=#cc3300>dice.com</FONT></STRONG></A>. I did filter a bunch out for WebWork b/c there's some product called "WebWorks" that folks want to hire for. <BR minmax_bound="true"><BR minmax_bound="true">In my own experience, these numbers are not as accurate as you might think. Since I gave my original presentation, I've been contacted a number of times to work on projects. It's about even between Struts, Spring MVC, WebWork and JSF. I haven't had a single inquiry to do Tapestry development. The bad part about Struts jobs is there's so many of them, that rates are likely pretty low (i.e. 35-45/hour), whereas the others can get you upwards of 80-90/hour. <BR><FONT style="BACKGROUND-COLOR: #ffa500" color=#0000ff><FONT style="BACKGROUND-COLOR: #ffffff">依我个h的经验,q些数字不一定就很准?自从我发表第一介l以来,我已l在目中用了好多ơ,包括Struts, Spring MVCQ?WebWorks 和JSFQ?我还没有做Tapestry开发?Struts不好的方面就是太多了Q其工资可能E微低一点(35/45/hour) ,而用其他框架能你提高到80-90/hour?/FONT>     <STRONG> <BR></STRONG></FONT><BR>So what do these numbers mean? Do they mean you should tailor your learnings and skills to the most popular frameworks? In a sense, it's important to do so. If nothing else, Struts skills are import so you can migrate all the Struts applications to your favorite framework. However, I don't think these numbers are that important when choosing a framework to start your project with. I think the most important thing in choosing a framework is <EM minmax_bound="true">passion</EM>. Which one do you want to work with the most? It's likely that your productivity will be higher if you're enthusiastic about the framework, rather than bored with all the skills you've accumulated using it. Then again, if you're motivated by productivity more than enthusiasm - using your skills to crank out applications quickly is probably a good idea. <BR><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #ffa500"><FONT style="BACKGROUND-COLOR: #ffffff">那么q些数字意味着我们应该做什么呢Q是不是意味着应该学习那些最行的框Ӟ乍眼看来Q这样做是很重要的?如果没有别的QStruts是很重要的,q且你可以将你所有的Struts应用q移C钟爱的框架中。不q,我认些数字对你选择一U框架开始你的项目来说不是重要的。我惛_选择一U框架时最重要的是passionQ激情)。你最想用哪一个框架工作呢Q或许如果你对一个框架很热情Q你的生产力获得极大的提高Q而不是乏味的使用已经U篏的技术?另外Q如果你׃生力推动而不是激情,那么q用你已U篏的技术去完成目可能是一个好L?/FONT></FONT></FONT></P> <P minmax_bound="true">You might think that the number of skilled developers for framework X is important too. I don't think it is. I think the most important thing is to hire <EM minmax_bound="true">smart developers</EM>. A good developer can come up to speed on <EM minmax_bound="true">any</EM> framework in 2 weeks and be highly productive in 4 weeks. If not, the developer isn't that smart or the framework isn't that good. <IMG class=smiley title=;-) alt=;-) src="http://raibledesigns.com/images/smileys/wink.gif" minmax_bound="true"> <BR><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #ffffff">你可能认为某个框架有l验的开发者的数量也很重要Q我不这么认为,我认为最重要的事情是雇用_明的开发者。一个好的开发h员能在两周时间内使用M框架Qƈ且在四周旉内能熟练q用?如果不是q样的话Q?q个开发h员就不是_明的开发者, 或者这个框架不是优U的?/FONT><BR></FONT><BR>Just for kicks, I did some searching for other web frameworks as well:</P> <UL class=glassList minmax_bound="true"> <LI minmax_bound="true">Rife: 0 <LI minmax_bound="true">Wicket: 0 <LI minmax_bound="true">Echo: 3 <LI minmax_bound="true">Ruby on Rails: 1 <LI minmax_bound="true">ASP .NET: 2876 </LI></UL> <P minmax_bound="true">Now the question is - what kind of rates are these skills getting? I'd like to know what the average Rails and ASP .NET developers make. In Denver, Java developers seem to make between 65-85/hour when they're experienced contractors</P><img src ="http://www.tkk7.com/soochow_hhb/aggbug/5257.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/soochow_hhb/" target="_blank">soochow_hhb 以java论成?以架构论英雄</a> 2005-05-27 11:18 <a href="http://www.tkk7.com/soochow_hhb/archive/2005/05/27/5257.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts学习心得之Struts程(3Q?Q示?l?/title><link>http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts31.html</link><dc:creator>soochow_hhb 以java论成?以架构论英雄</dc:creator><author>soochow_hhb 以java论成?以架构论英雄</author><pubDate>Thu, 19 May 2005 02:57:00 GMT</pubDate><guid>http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts31.html</guid><wfw:comment>http://www.tkk7.com/soochow_hhb/comments/4857.html</wfw:comment><comments>http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts31.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.tkk7.com/soochow_hhb/comments/commentRss/4857.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/soochow_hhb/services/trackbacks/4857.html</trackback:ping><description><![CDATA[     摘要:      W二步:实现controller。在Struts中承自Action。调用ModelQ实现数据的深层ơ检验(email是否存在Q和数据的插入,E序的蟩转等。代码如下:SignAction.java  1/**//** 2 * @author han 3 * soo...  <a href='http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts31.html'>阅读全文</a><img src ="http://www.tkk7.com/soochow_hhb/aggbug/4857.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/soochow_hhb/" target="_blank">soochow_hhb 以java论成?以架构论英雄</a> 2005-05-19 10:57 <a href="http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts31.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts学习心得之Struts程(3Q?Q示?/title><link>http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts3.html</link><dc:creator>soochow_hhb 以java论成?以架构论英雄</dc:creator><author>soochow_hhb 以java论成?以架构论英雄</author><pubDate>Thu, 19 May 2005 02:31:00 GMT</pubDate><guid>http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts3.html</guid><wfw:comment>http://www.tkk7.com/soochow_hhb/comments/4841.html</wfw:comment><comments>http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts3.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/soochow_hhb/comments/commentRss/4841.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/soochow_hhb/services/trackbacks/4841.html</trackback:ping><description><![CDATA[     摘要: 本文通过一个实例——用h册——来说明Struts讄的一般流E和ҎQ中间设计到Struts的错误处理,资源文g使用和持久化工具Hibernate的用,q些信息都可以从本blog中找到? 文章有一下几个部分组成:Q?Q实例介l; Q?Q?不用MVC模式Q(3Q用MVC模式Q(4Q用Struts实现用户注册的过E?nbsp; <a href='http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts3.html'>阅读全文</a><img src ="http://www.tkk7.com/soochow_hhb/aggbug/4841.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/soochow_hhb/" target="_blank">soochow_hhb 以java论成?以架构论英雄</a> 2005-05-19 10:31 <a href="http://www.tkk7.com/soochow_hhb/archive/2005/05/19/struts3.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts学习心得之Struts程(2Q?http://www.tkk7.com/soochow_hhb/archive/2005/05/03/struts2.htmlsoochow_hhb 以java论成?以架构论英雄soochow_hhb 以java论成?以架构论英雄Tue, 03 May 2005 01:35:00 GMThttp://www.tkk7.com/soochow_hhb/archive/2005/05/03/struts2.htmlhttp://www.tkk7.com/soochow_hhb/comments/3996.htmlhttp://www.tkk7.com/soochow_hhb/archive/2005/05/03/struts2.html#Feedback2http://www.tkk7.com/soochow_hhb/comments/commentRss/3996.htmlhttp://www.tkk7.com/soochow_hhb/services/trackbacks/3996.htmlQ?QTomcat的启动?BR>        从上一节的Tomcat的配|文件中Q我们可以看到关于Struts的配|,当Tomcat启动Ӟ会加载Struts的配|文件struts-config.xmlQ关于配|文件的内容误
 Q?QJSP/JavaBean开发Web应用
     在asp的时代,我们q没有讨Z么开发模式,也没有顾及MVCQ虽然MVC的概忉|已出玎ͼ。用asp开发不外乎以下两种情况Q一、就是直接将代码集成到asp文g中,l验多的话,会将常用的函数放至一P引用时只需include卛_Q二、对于复杂的应用Q如文g上传{,我们会用其他语音如VB、Delphi{写一个控ӞADO卛_于此c)?BR>     当java行QJSP逐渐成熟Q也正是模式、框架流行的时代Q所以我们不是看java的类库,q是看现在流行的框架Q无一没有模式的存在。当你初接触JSP的时候,可以看C上说“尽量少的在jsp中插入Java代码”,q句话已是模式运用的端倪?BR>      下面我们先不MVCQ先从JSP/JavaBean来看Web的开发。这U模式很想上面提到的asp开发的W二U情况,我们业务逻辑攑ֈJavaBean中,只用JSP去表C页面?BR>       有过aspl验都知道,在接收表单数据的时候,我们不得不一个一个将数据接收q来Q以至于有很长的一D如QCustomId Q?request("CustomId")的代码。而在JSP中,我们不用q么J琐Q一个我们可以用EL直接表示卛_Q另外我们可以利用javaBean的introspection机制。直接将表单的数据映到javabean的private变量中,当然javabean中必d含getter和setter函数Q有很幸q,很多的开发工具可以自动生成,又减了工作量)。下面是一个示例?BR>       
<jsp:useBean id="prof" scope="page" class="register.Profile" />
<jsp:setProperty name="prof" property="*" />
       我们只要表单的action面中,直接插入以上代码Q这些代码就不用解释了吧Q,可以将表单中的数据映射到register.Profileq个javabean中,所以我们可以在javabean中实C务逻辑Q譬如数据的插入、修攏V删除等。从而可以减甚x除JSP中的java代码量?BR> Q?QMVC模式
     上面提到的JSP/JavaBean与MVC模式很接q,但是q有很多差别。前者,我们可以看出Q在javabean中有很多的逻辑代码Q我们要控制面的蟩转,q是要在JSP中读取javabean中的某些标志Q嵌入java代码来实玎ͼq看h昑־有些W拙。我们是否能在JSP和javabean中再加一层,专门来实现蟩转即控制面的输出呢Qof courseQ这是MVC的思想?BR>      Struts是一个实现MVC模式的WEB开发框Ӟ在Struts中用JSP作ؓViewerQjavabeanl承自ActionForm来映JSP表单数据Q用l承自Action的类来实现ControllerQ而Model没有Ҏ定义Q它可以是EJBQ普通Bean或者Web服务QMModel中集成了业务逻辑的实玎ͼ在Controller中去调用Q完成后Controller控制昄面Qjsp文gQ?BR>     q样一来,是不是业务流E非常的清晰Q?BR>
     下面我们付诸实践Q实C个用h册的单实例!


soochow_hhb 以java论成?以架构论英雄 2005-05-03 09:35 发表评论
]]>
Struts学习心得之Struts程(1Q?/title><link>http://www.tkk7.com/soochow_hhb/archive/2005/05/02/stucts1.html</link><dc:creator>soochow_hhb 以java论成?以架构论英雄</dc:creator><author>soochow_hhb 以java论成?以架构论英雄</author><pubDate>Mon, 02 May 2005 12:00:00 GMT</pubDate><guid>http://www.tkk7.com/soochow_hhb/archive/2005/05/02/stucts1.html</guid><description><![CDATA[     摘要: 刚接触StrutsQ刚接触MVC架构Q或者刚接触MC西,我觉得首先要搞清楚流E,要对C物有一个大概的、M的认识,先有感性认识,先培养v来兴是非常重要的。下面就把我学习Struts的M业务程通过一个实例来q行概括Q有什么错误和不妥之处Q请你发表评论指教!   <a href='http://www.tkk7.com/soochow_hhb/archive/2005/05/02/stucts1.html'>阅读全文</a><img src ="http://www.tkk7.com/soochow_hhb/aggbug/3992.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/soochow_hhb/" target="_blank">soochow_hhb 以java论成?以架构论英雄</a> 2005-05-02 20:00 <a href="http://www.tkk7.com/soochow_hhb/archive/2005/05/02/stucts1.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> վ֩ģ壺 <a href="http://3baimm.com" target="_blank">޾ƷƵ</a>| <a href="http://gnebs.com" target="_blank">С˵</a>| <a href="http://513109.com" target="_blank">ԴѸ߲</a>| <a href="http://czxgjt.com" target="_blank">ҹƬ߹ۿ</a>| <a href="http://988938.com" target="_blank">޾ƷWWWþþþþ</a>| <a href="http://9844555.com" target="_blank">պƷƵ</a>| <a href="http://sh-shule.com" target="_blank"> պ ɫ ͼվ</a>| <a href="http://conghui8.com" target="_blank">Ļ</a>| <a href="http://cdlsy.com" target="_blank">ձ</a>| <a href="http://lhtjdj.com" target="_blank">jizzһ</a>| <a href="http://88533066.com" target="_blank">þþþavר</a>| <a href="http://livejimmy.com" target="_blank">ëƬƵ</a>| <a href="http://342030.com" target="_blank">aѹۿþav</a>| <a href="http://bjlfggcm.com" target="_blank">һ234 </a>| <a href="http://mychjp.com" target="_blank">޾ƷaĻ</a>| <a href="http://155lh.com" target="_blank">Ѵվ߹</a>| <a href="http://liulian88.com" target="_blank">һëƬѹۿƵ</a>| <a href="http://51xinshiji.com" target="_blank">avһۿ</a>| <a href="http://666fzw.com" target="_blank">˳ŷþ</a>| <a href="http://023npxyy.com" target="_blank">˸Ƶ</a>| <a href="http://www-yhty.com" target="_blank">˸ŮѲžþþ</a>| <a href="http://s88s88.com" target="_blank">ۺϾþþƷɫ</a>| <a href="http://gdporun.com" target="_blank">Ļղapp</a>| <a href="http://www-44334.com" target="_blank">ŮҹëƬƵ</a>| <a href="http://789xxoo.com" target="_blank">弦վ߲ѹۿ</a>| <a href="http://hbjinmaitang.com" target="_blank">޹ŮƵ</a>| <a href="http://shulan88.com" target="_blank">AVպAV</a>| <a href="http://gzjing365.com" target="_blank">ձػɫaaƬ</a>| <a href="http://xx2e.com" target="_blank">97ԭѹۿ</a>| <a href="http://yuejiju.com" target="_blank">պһƵ </a>| <a href="http://zhuanjiao521.com" target="_blank">պѹۿһëƬ</a>| <a href="http://thinkchating.com" target="_blank">һëƬ߲Ƶ</a>| <a href="http://www2626cf.com" target="_blank">þav޾Ʒɫҹ</a>| <a href="http://zgbeian.com" target="_blank">þþƷavӰԺ</a>| <a href="http://jggbk.com" target="_blank">þ޹ӰԺվ</a>| <a href="http://45-po.com" target="_blank">߾ƷƵ</a>| <a href="http://8mav950.com" target="_blank">ձzzzzwwwƬ</a>| <a href="http://gtja1668.com" target="_blank">ѳƵۿ</a>| <a href="http://99880524.com" target="_blank">ɫƷƵ</a>| <a href="http://shlamore.com" target="_blank">ۺС˵ͼƬͼ</a>| <a href="http://yunyitai.com" target="_blank">ۺۺͼ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>