struts1.x +Spring2.0
1.web容器监听IOC
web.xml中配置:
<!-- 监听器监听的上下文路径配置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext-*.xml</param-value>
</context-param>
<!--Spring2.x整合struts1.x 由spring监听器web上下文需要的bean实例,由web容器来控制IOC中Bean -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
2.struts-config-xml中
<!-- struts1+spring整合 -->
<action-mappings>
<action path="/login" parameter="op" />
</action-mappings>
<!-- 请求的委托代理,其作用是将用户的请求转到IOC容器中找相应的Action -->
<controller>
<set-property property="processorClass"
value="org.springframework.web.struts.DelegatingRequestProcessor"/>
</controller>