<!--
- Configures Log4J for this web app.
- As this context specifies a context-param "log4jConfigLocation", its file path
- is used to load the Log4J configuration, including periodic refresh checks.
-
- Would fall back to default Log4J initialization (non-refreshing) if no special
- context-params are given.
-
- Exports a "web app root key", i.e. a system property that specifies the root
- directory of this web app, for usage in log file paths.
- This web app specifies "petclinic.root" (see log4j.properties file).
-->
<!-- Leave the listener commented-out if using JBoss -->
<!--
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
-->
<!--
- Loads the root application context of this web app at startup,
- by default from "/WEB-INF/applicationContext.xml".
- Note that you need to fall back to Spring's ContextLoaderServlet for
- J2EE servers that do not follow the Servlet 2.4 initialization order.
-
- Use WebApplicationContextUtils.getWebApplicationContext(servletContext)
- to access it anywhere in the web application, outside of the framework.
-
- The root context is the parent of all servlet-specific contexts.
- This means that its beans are automatically available in these child contexts,
- both for getBean(name) calls and (external) bean references.
-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
首先需要配置ContextLoaderListener,如果要配置Log4jConfigListener,那么一定要配置在ContextLoaderListener的前面。
ContextLoaderListener是加载应用的上下方环境(context),如果把这个context记为A,那么A下面还可以有子Context,这些Context配置在以*-servlet.xml的文件中。可以配置多个*-servlet.xml,它们共享context A。
Log4j的配置文件可以定制:
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>
分享到:
相关推荐
本源码将详细介绍web.xml配置中servlet,filter,listener的加载顺序,可以让学习者更好的了解web.xml各种属性配置,自己写的东西,不足之处请大家见谅,顺便收点积分也好下资料,谢谢
关于web.xml配置的详细说明,作者总结得很好,适合新手学习。在网上档的,整理成pdf文档,供同志们使用。内附原文地址。
java学习-web.xml配置详解实用.pdf
这是一些配置文件,可以作为参考,个人感觉很方便的学习方法
session的过期时间需要配置在tomcat 中的 web.xml 中,时间以分钟计算。另最大时间好像是24小时,就是说,你的session过期时间可以设置成1440,如果设置成1441是无效的。(还没有测试) 代码如下: <session> <session>...
主要给大家介绍了关于Struts2.5版本中struts.xm与web.xml配置的更改方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
包换7个文档,DWR学习笔记,中文API,DWR开发培训.ppt,WEB界面开发规范.doc,DWR.xml配置文件说明书.doc,DWRchinese.pdf,
主要介绍了Spring手动生成web.xml配置文件过程详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
主要介绍了JavaWeb工程web.xml基本配置过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
主要介绍了SpringMvc web.xml配置实现原理过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
此外,本书的配套光盘还免费提供了价值人民币330元的java教学视频,对java语言进行了全面讲解,帮助一些不会java语言的读者快速地从java基础知识的学习中过渡到java web的学习与开发上. 第1部分 xml篇. 第1章 xml...
因此,学习server.xml文件的配置,对于了解和使用 Tomcat 至关重要。 本文将通过实例,介绍server.xml中各个组件的配置,并详细说明 Tomcat 各个核心组件的作用以及各个组件之间的相互关系。 说明:由于server....
主要介绍了spring web.xml指定配置文件过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
本文是一篇初学Spring Web Flow的Demo,xml配置,纯流程跳转。
很好的配置文件 web.xml配置文件啊 要好好学习啊
NULL 博文链接:https://dlevin.iteye.com/blog/655727
. 搭建Struts 2 开发环境; 2. 建立一个Web Project(命名为struts_exam1),并添加Struts 2 的相关jar 包; 3. 编写登录页面(login.jsp)、登录成功(login_success.jsp)和登录...5. 配置web.xml; 6. 配置struts.xml;
此外,本书的配套光盘还免费提供了价值人民币330元的java教学视频,对java语言进行了全面讲解,帮助一些不会java语言的读者快速地从java基础知识的学习中过渡到java web的学习与开发上. 第1部分 xml篇. 第1章 xml...
此外,本书的配套光盘还免费提供了价值人民币330元的java教学视频,对java语言进行了全面讲解,帮助一些不会java语言的读者快速地从java基础知识的学习中过渡到java web的学习与开发上. 第1部分 xml篇. 第1章 xml...