标签‘非注入’

整合Spring与Struts1的三种方法总结

1.使用Spring 的 ActionSupport 。
2.使用Spring 的 DelegatingRequestProcessor 类。
3.全权委托。

无论用那种方法来整合第一步就是要为struts来装载spring的应用环境。 就是在 struts 中加入一个插件。struts-config.xml中

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"></set-property>
</plug-in>

spring 的配置文件被作为参数配置进来。这样可以省略对web.xml 文件中的配置。确保你的applicationContext.xml 在WEB-INF目录下面 查看更多...