浏览 313 次
|
该帖已经被评为新手帖
|
|
|---|---|
| 作者 | 正文 |
|
最后更新时间:2008-03-25
用spring来管理action的方法,把每个action都注入了applicationContext.xml中
在struts-config.xml中action的type用的是org.springframework.web.struts.DelegatingActionProxy类 交给spring来管理 <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" /> 第一种: web.xml
<context-param>
<param-name> contextConfigLocation </param-name>
<param-value> /WEB-INF/applicationContext.xml </param-value>
</context-param>
<servlet-name>SpringContextServlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
第二种: web.xml
<context-param>
<param-name> contextConfigLocation </param-name>
<param-value> /WEB-INF/applicationContext.xml </param-value>
</context-param>
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener </listener-class>
</listener>
第三种: 用struts-config.xml的 <plug-in className= "org.springframework.web.struts.ContextLoaderPlugIn "> <set-property property= "contextConfigLocation " value= "/WEB-INF/applicationContext.xml " /> </plug-in> 声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |


