`

Spring整合Struts2

阅读更多
  1. 将需要的jar包加到lib下

  2. 修改web.xml文件,增加一个listener,代码如下
    <listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<!--
    				默认找的位置是:/WEB-INF/applicationContext.xml
    			-->
    		<!--
    			<param-value>/WEN-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
    		-->
    		<param-value>classpath:beans.xml</param-value>
    	</context-param>
     

  3. 通过上面的配置后,就可以在Spring容器中通过IoC来注入相关的Action

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics