[align=center][size=xx-large][color=red][b]把action交给spring管理
[/b][/color][/size][/align]
参考链接:
1.[url]http://www.blogjava.net/zJun/archive/2007/01/08/92417.html[/url]
2.[url]http://love398146779.iteye.com/blog/909723[/url]
3.[url]http://blog.sina.com.cn/s/blog_6848c4440100siua.html[/url]
[size=medium][b][color=red]一、spring和struts1.x[/color][/b][/size]
spring的一个jar包:[color=red]spring-webmvc-struts.jar[/color]
[color=red]<plug-in/>[/color]将struts的处理转给Spring了,由Spring IOC控制调用Struts中的组件,这样你就需要在Spring那个applicationContext.xml中加入Action相应的bean类
1.web.xml里配置struts-config.xml(struts1.x配置文件),Tomcat启动加载该文件。
2.applicationContext-action.xml
[size=medium][b][color=red]二、spring和struts2.x[/color][/b][/size]
通过struts2.x里的一个jar包,启动自动将struts2.x控制权给spring
spring的一个jar包:[color=red]struts2-spring-plugin-2.1.8.1.jar[/color]
[/b][/color][/size][/align]
参考链接:
1.[url]http://www.blogjava.net/zJun/archive/2007/01/08/92417.html[/url]
2.[url]http://love398146779.iteye.com/blog/909723[/url]
3.[url]http://blog.sina.com.cn/s/blog_6848c4440100siua.html[/url]
[size=medium][b][color=red]一、spring和struts1.x[/color][/b][/size]
spring的一个jar包:[color=red]spring-webmvc-struts.jar[/color]
[color=red]<plug-in/>[/color]将struts的处理转给Spring了,由Spring IOC控制调用Struts中的组件,这样你就需要在Spring那个applicationContext.xml中加入Action相应的bean类
1.web.xml里配置struts-config.xml(struts1.x配置文件),Tomcat启动加载该文件。
<action name="treeForm" path="/tree" scope="request"
parameter="actions"
type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="select"
path="/platform/common/treeSelect.jsp" />
<forward name="defeat" path="/common/error.jsp" />
</action>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/classes/spring/core/applicationContext-action.xml" />
</plug-in>
注意:此处的plug-in也可以注释掉,直接在applicationContext.xml里加载applicationContext-action.xml也可以
2.applicationContext-action.xml
<bean name="/frameTest" class="com.lenovo.example.web.action.FrameTestAction">
<property name="frameTestService" ref="frameTestService" />
</bean>
<bean name="/flowTest" class="com.lenovo.example.web.action.FlowTestAction">
<property name="flowTestService" ref="flowTestService" />
<property name="flowService" ref="engineflowService"/>
</bean>
[size=medium][b][color=red]二、spring和struts2.x[/color][/b][/size]
通过struts2.x里的一个jar包,启动自动将struts2.x控制权给spring
spring的一个jar包:[color=red]struts2-spring-plugin-2.1.8.1.jar[/color]