struts和spring
struts-config.xml 文件:
1、把 action 的type 属性,设置为org.springframework.web.struts.DelegatingActionProxy
<action
path="/LoginAction"
type="org.springframework.web.struts.DelegatingActionProxy"
name="loginForm"
>
2、在struts配置文件struts-config.xml中注册插件:
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/config.xml"/>
</plug-in>
3、在spring配置文件config.xml配置注入:
<bean name="/LoginAction" class="web.LoginAction">
<property name="userCheckService">
<ref bean="usercheck"/>
</property>
</bean>
注:userCheckService 为LoginAction里的属性,由spring注入
原码略......