|
struts1加载spring的两种方式
作者无: 加入时间:2008-11-18 17:05:40 点击次数:10 次第一种:通过web.xml配置加载spring上下文环境,其配置方式如下:web.xml<context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/applicationContext.xml</param-value></context-param>通过listener加载<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>或者利用severlet类加载<servlet><servlet-name>context</servlet-name> <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class><load-on-startup>1</load-on-startup> </servlet> 第二种方式:使用Struts插件在struts-config.xml中<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"><set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/></plug-in> 这两种配置的明显区别就是,第一种方式可以配置多个spring配置文件。 上一篇: Struts的模块使用方法 下一篇: Struts中的MVC 精华 |
|||||||||||||||||||||||||||||||||||||||||||||
| 关于我们 | 代理申请 | 付款方式 | 客户管理 | 友情链接 | 网站导航 |
| 版权所有 2008 三易网络(洛阳)科技开发有限公司 服务热线:0379-63921200 63265368(洛阳) 0371-63653120(郑州) QQ在线客服: 总部地址:纱厂南路41号中泰新城泰华苑12楼B座 郑州分公司地址:金水区圣菲城 |