随笔-61  评论-159  文章-0  trackbacks-0
webwork和spring的整合:
1、webwork.properties文件中加入webwork.objectFactory = spring
2、配置web.xml

<filter>
  <filter-name>webwork</filter-name>
  <filter-class>
   com.opensymphony.webwork.dispatcher.FilterDispatcher
  </filter-class>
 </filter>
 <filter-mapping>
  <filter-name>webwork</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>

</web-app>

3、xwork.xml文件配置
由于webwork的action交给spring的IoC来管理,xwork.xml配置简化:
   <action name="login" class="userAction">
   <result name="success">/login_success.jsp</result>
   <result name="error">/login.jsp</result>
4、spring的applicationContext.xml配置
<bean id="userAction" class="org.apple.action.UserAction">
  <property name="userService">
   <ref bean="userService"/>
  </property>
 </bean>
经过几步的配置,webwork和spring的整合完成。

-------------------------------------------------------------------------------------------------
PS:本博客文章,如果没有注明是有“转”字样,属于本人原创。如果需要转载,务必注明作者文章的详细出处地址,否则不允许转载,多谢合作!
posted on 2007-10-02 23:50 apple0668 阅读(1389) 评论(2)  编辑  收藏 所属分类: springwebwork

评论:
# re: webwork与spring整合 2007-10-12 16:32 | Ankey
没有这句webwork.objectFactory = spring 怎么整合spring啊!  回复  更多评论
  
# re: webwork与spring整合 2007-10-12 19:25 | apple0668
@Ankey说的确实是,要在webwork.properties文件里面加入:webwork.objectFactory = spring

PS:我的第一点不是说明了1、webwork.properties文件中加入webwork.objectFactory = spring么?你没看清楚吧!  回复  更多评论
  

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


网站导航: