Key Changes From WebWork 2

本文档概述了从WebWork2平滑过渡到Struts2的路径,包括系统平台需求变化、成员存储名称变更、新特性及功能变化等关键信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The upgrade path from WebWork 2 to Struts 2 is smooth glide. Here's the roadmap.

System Platform

  • Struts 2 is dependant on XWork 2 (beta-1).
  • Java 1.5 is required to build Struts 2.
    • For Java 1.4 deployments, RetroTranslater JARS are available with the distribution.

For other changes from WebWork 2, see the "Members to rename", "New property settings", "New features or feature changes", and "Removed or deprecated" sections.

Members to rename
WebWork 2 Struts 2
com.opensymphony.xwork.* com.opensymphony.xwork2.*
com.opensymphony.webwork.* org.apache.struts2.*
xwork.xml struts.xml
webwork.properties struts.properties
DispatcherUtil Dispatcher
com.opensymphony.webwork.config.Configurationorg.apache.struts2.config.Settings

The tag prefix conventions in the example applications have changed.

JSP s: <s:form ...>
Freemarker s. <@s.form ...>
Velocity s #sform ( ... )
New property settings
struts.enable.DynamicMethodInvocation Enable support for the hardwired action!alias syntax (Default is TRUE)
It is recommended that all applications specify the DynamicMethodInvocation setting for now, since the default may change. The recommended approach to action aliasing is to use wildcard aliases instead of the hardwired bang.
New features and feature changes
  • Various changes to ConfigurationManager
    • ConfigurationManager is no longer a static factory. It is now an instance created through Dispatcher. Custom configuration could be done through DispatcherListener.
    • Custom configuration to ConfigurationManager and Configuration cannot be done statically anymore, instead use Dispatcher's DispatcherListener to achieve the same effect.
  • The prepare interceptor now uses reflection to call prepare_Method_ where method is the action method configured for the particular action in struts.xml.
    <action name="myAction" method="insert" ....>
         .....
       </action>
    
       // with the above configuration, and PrepareInterceptor in play, 
       // callsequence will be 
       1] prepareInsert() (If it exists)
       2] prepare() (Unless Interceptor's alwaysInvokePrepare parameter is set to false)
       3] insert()
  • DefaultWorkflowInterceptor (named workflow in struts-default.xml) now uses reflection to call validateMethod on the action class that implements Validateable interface where method is the action method configured for the particular action in struts.xml.
    <action name="myAction" method="insert" ...>
           ...
        </action>
    
        // with the above configuration, and DefaultWorkflowInterceptor in play, 
        // call sequence for action that implements Validateable interface will be 
        1] validateInsert()
        2] validate() (unless Interceptor's alwaysInvokeValidate parameter is set to false)
        3] insert()
  • The tooltip library used by the xhtml theme was replaced by Dojo's tooltip component.
  • Datepicker tag has been renamed to datetimepicker and is now using dojo (limited in terms functionality and internationalization)
  • Tiles integration plugin is available.
  • Wildcards can be specified in action mappings.
  • MessageStoreInterceptor is introduced to allow field errors / action errors and messages to be store and retrieve through session, resulting them to be preservable across request.
Removed or deprecated
AroundInterceptorThe AroundInterceptor has been removed. If your application extends the AroundInterceptor, either import the class into your source code form WebWork 2 (pursuant to the Open Symphony License) and modify it to server as your own base class, or rewrite your interceptor.
oldSyntaxSupport for the "oldSyntax" is removed.
Rich text editor tag Rich text editor tag is removed and replaced by Dojo's rich text editor
doActionMethod The convention of trying a "do" form of an action method is not supported.
<action name="..." method="submit">
    ...
  </action>
In WebWork,
  • try to execute submit method in the action, fail
  • try to execute doSubmit method in the action if Step 1, fail
  • fail
    In Struts,
  • try to execute submit method in the action, fail
  • fail
default method Calling the "default" method via "doDefault" is not supported.
IOC framework Deprecated in WebWork 2.2, the internal IOC framework is removed in Struts 2. Spring is the ObjectFactory default.
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值