Spring管理struts中的action

让Spring管理struts中的action,可以在struts.xml中增加配置
<constant name="struts.objectFactory" value="spring" />
并且在web.xml中定义spring监听器
       
<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext.xml</param-value>
	</context-param>

	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

由于org.springframework.web.context.ContextLoaderListener是在spring-web.jar包中,所以需将WEB-INF/lib中加入spring-web.jar包

你可能感兴趣的:(spring,Web,xml,struts,配置管理)