`

webwork与spring整合

阅读更多
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的整合完成。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics