首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

web项目中加载spring器皿的方式

2012-07-26 
web项目中加载spring容器的方式1、在Web.xml中,通过ContextLoaderListener加载?context-param ??? param

web项目中加载spring容器的方式

1、在Web.xml中,通过ContextLoaderListener加载

?
<context-param>

??? <param-name>contextConfigLocation</param-name>

??? <param-value>/WEB-INF/daoContext.xml /WEB-INF/applicationContext.xml</param-value>

</context-param>

<listener>

??? <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>

?

2、在Web.xml中,通过ContextLoaderServlet加载


<context-param>

??? <param-name>contextConfigLocation</param-name>

??? <param-value>/WEB-INF/daoContext.xml /WEB-INF/applicationContext.xml</param-value>

</context-param>

<servlet>

??? <servlet-name>context</servlet-name>

??? <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>

??? <load-on-startup>1</load-on-startup>

</servlet>


3、在struts-config.xml中,通过ContextLoaderPlugIn加载


<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">

??? <set-property property="contextConfigLocation" value="/WEB-INF/action-servlet.xml,

??????? /WEB-INF/applicationContext.xml"/>

</plug-in>

?

热点排行