测试版本:Struts2.3.4 、Spring3.2
1、确保你的struts2-spring插件jar包已经添加
2、将如下代码复制到web.xml中
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/beans.xml</param-value> <!-- 此处存放spring的配置文件-->
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
3、在struts.xml中指定objectFactory
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
本文介绍如何在Struts2.3.4与Spring3.2环境下进行整合配置。主要内容包括添加struts2-spring插件jar包、在web.xml中配置Spring监听器以及在struts.xml中指定objectFactory。
2万+

被折叠的 条评论
为什么被折叠?



