| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6257 人关注过本帖
标题:struts+spring No WebApplicationContext found: no ContextLoaderListen ...
只看楼主 加入收藏
Ethip
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:771
专家分:0
注 册:2008-1-18
收藏
得分:0 
Struts1加载Spring的两种方式:

第一种:通过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>
2008-11-06 10:25
快速回复:struts+spring No WebApplicationContext found: no ContextLoaderL ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017269 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved