使用代理,指明处理action的xml文件,然后原来action里指定的类都改成type="org.springframework.web.struts.DelegatingActionProxy"
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/action-servlet.xml"/>
</plug-in>
例子
你要spring管理action 可以这样子实现一下
把action交给spring管理
Java code
<action
path="/login"
attribute="usersForm"
name="usersForm"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy"
validate="false"/>
<action
attribute="usersForm"
name="usersForm"
path="/users"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy"
validate="false" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml"/>
</plug-in>
applicationContext.xml配置
<bean name="/users,/login" class="om.bbs.struts.action.LoginAction" singleton="false"
lazy-init="default" abstract="false" dependency-check="default" autowire="default">
<property name="userservice">
<ref bean="UsersService" />
</property>
</bean>