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來(lái)管理,xwork.xml配置簡(jiǎn)化:
<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>
經(jīng)過(guò)幾步的配置,webwork和spring的整合完成。
-------------------------------------------------------------------------------------------------
PS:本博客文章,如果沒(méi)有注明是有“轉(zhuǎn)”字樣,屬于本人原創(chuàng)。如果需要轉(zhuǎn)載,務(wù)必注明作者和文章的詳細(xì)出處地址,否則不允許轉(zhuǎn)載,多謝合作!