无聊人士

搬家==》www.soapui.cn

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  32 随笔 :: 0 文章 :: 60 评论 :: 0 Trackbacks

1、webwork.properties

ww2.2.1默认的webwork.properties配置已经非常不错,i18n用utf-8,ioc用spring,fileup用jakarta。因此,我的webwork.properties就只剩两行
1 webwork.multipart.maxSize=209715200
2 webwork.action.extension=ftl #个人恶习,用freemarker做view,再加上不喜欢.action、.do的扩展名,就直接配成ftl了,用frontpage等软件时也比较方便

2、web.xml

ww2.1.7是配servlet的,为了与spring集成,还得加上一个listener
 1     <context-param>
 2         <param-name>contextConfigLocation</param-name>
 3         <param-value>classpath:beans.xml,classpath:com/yninfo/rules/spring.scheduling.xml</param-value>
 4     </context-param>
 5     <listener>
 6         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 7     </listener>
 8     <listener>
 9         <listener-class>com.opensymphony.xwork.spring.SpringExternalReferenceResolverSetupListener</listener-class>
10     </listener>
11     <servlet>
12         <servlet-name>webwork</servlet-name>
13         <servlet-class>com.opensymphony.webwork.dispatcher.ServletDispatcher</servlet-class>
14         <load-on-startup>1</load-on-startup>
15     </servlet>
16     <servlet-mapping>
17         <servlet-name>webwork</servlet-name>
18         <url-pattern>*.ftl</url-pattern>
19     </servlet-mapping>
ww2.2.1改成filter,也不需要配listener来处理spring

3、xwork.xml

原来的配置
 1 <xwork>
 2     <include file="webwork-default.xml" />
 3     <package name="default" extends="webwork-default"
 4         externalReferenceResolver="com.opensymphony.xwork.spring.SpringExternalReferenceResolver">
 5         <interceptors>
 6             <interceptor name="reference-resolver"
 7                 class="com.opensymphony.xwork.interceptor.ExternalReferencesInterceptor" />
 8             <interceptor-stack name="default-stack">
 9                 <interceptor-ref name="timer" />
10                 <interceptor-ref name="logger" />
11                 <interceptor-ref name="completeStack" />
12                 <interceptor-ref name="reference-resolver" />
13             </interceptor-stack>
14         </interceptors>
15 
16         <action name="rule" class="com.yninfo.rules.web.action.RuleAction">
17             <result name="success" type="freemarker">
18                 <param name="location">/rule.ftl</param>
19             </result>
20             <result name="error" type="freemarker">
21                 <param name="location">/rule_error.ftl</param>
22             </result>
23             <external-ref name="ruleManager">RuleManager</external-ref>
24         </action>
25     </package>
26 </xwork>
ww2.2.1以后的配置,去掉了上面旧配置中粗体部分
 1 <xwork>
 2     <include file="webwork-default.xml" />
 3     <package name="default" extends="webwork-default">
 4         <interceptors>
 5             <interceptor name="reference-resolver"
 6                 class="com.opensymphony.xwork.interceptor.ExternalReferencesInterceptor" />
 7             <interceptor-stack name="default-stack">
 8                 <interceptor-ref name="timer" />
 9                 <interceptor-ref name="logger" />
10                 <interceptor-ref name="completeStack" />
11             </interceptor-stack>
12         </interceptors>
13 
14         <action name="rule" class="com.yninfo.rules.web.action.RuleAction">
15             <result name="success" type="freemarker">
16                 <param name="location">/rule.ftl</param>
17             </result>
18             <result name="error" type="freemarker">
19                 <param name="location">/rule_error.ftl</param>
20             </result>
21         </action>
22     </package>
23 </xwork>

4、注意:

ww2.2.1中ioc使用spring,默认的是byName,要求spring的beans.xml配置文件中id与ww action中的名称完全相同,由于我个人的恶习,不习惯首字母小写的写法,因此,在action中定义private AccountManager accountManager;,在spring中定义bean id="AccountManager",结果spring不能将AccountManager这个bean注入action的accountManager中,抛出NPE的异常
posted on 2006-02-04 16:46 mmwy 阅读(552) 评论(1)  编辑  收藏

评论

# re: 从webwork2.1.7升级到2.2.1 2008-07-07 13:01 hijokw
请问原来webwork用bodytag标签,用velocity,但升级2.24就不能运行了。说没有template  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: