`
jsamson
  • 浏览: 118235 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

spring在web.xml中配置

阅读更多
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="WebApp_1227143028044" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<!-- 加载Spring服务 -->
<context-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>
    classpath:/spring-dataSource.xml,
    classpath:/spring-data.xml, classpath:/spring-server.xml
   </param-value>
</context-param>

<!-- 加载log4j -->
<context-param>
   <param-name>log4jConfigLocation</param-name>
   <param-value>classpath:/log4j.properties</param-value>
</context-param>
<context-param>
   <param-name>webAppRootKey</param-name>
   <param-value>netctoss.root</param-value>
</context-param>

<!--处理请求编码格式-->
<filter>
   <filter-name>encodingFilter</filter-name>
   <filter-class>
    org.springframework.web.filter.CharacterEncodingFilter
   </filter-class>
   <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
   </init-param>
</filter>

<filter-mapping>
   <filter-name>encodingFilter</filter-name>
   <url-pattern>*.do</url-pattern>
</filter-mapping>

<!-- 自定义过滤器测试 -->
<filter>
   <filter-name>adminFilter</filter-name>
   <filter-class>com.ghrt.common.AdminFilter</filter-class>
</filter>

<filter-mapping>
   <filter-name>adminFilter</filter-name>
   <url-pattern>/admin/*</url-pattern>
</filter-mapping>

<!-- 监听Log4j -->
<listener>
   <listener-class>
    org.springframework.web.util.Log4jConfigListener
   </listener-class>
</listener>

<!-- 监听Spring文件 -->
<servlet>
   <servlet-name>SpringContextServlet</servlet-name>
   <servlet-class>
    org.springframework.web.context.ContextLoaderServlet
   </servlet-class>
   <load-on-startup>1</load-on-startup>
</servlet>


<!-- 配置dwr -->
<servlet>
   <servlet-name>dwr-invoker</servlet-name>
   <servlet-class>
    org.directwebremoting.servlet.DwrServlet
   </servlet-class> 
   <init-param>
    <param-name>debug</param-name>
    <param-value>true</param-value>
   </init-param>
   <load-on-startup>0</load-on-startup>
</servlet>

<servlet>
   <servlet-name>action</servlet-name>
   <servlet-class>
    org.apache.struts.action.ActionServlet
   </servlet-class>
   <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
   </init-param>
   <init-param>
    <param-name>debug</param-name>
    <param-value>3</param-value>
   </init-param>
   <init-param>
    <param-name>detail</param-name>
    <param-value>3</param-value>
   </init-param>
   <load-on-startup>0</load-on-startup>
</servlet>

<servlet>
   <description>
    This is the description of my J2EE component
   </description>
   <display-name>
    This is the display name of my J2EE component
   </display-name>
   <servlet-name>Image</servlet-name>
   <servlet-class>com.ghrt.common.Image</servlet-class>
</servlet>


<!-- eWebEditor 配置 -->
<display-name>defaultroot</display-name>

<servlet-mapping>
   <servlet-name>action</servlet-name>
   <url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
   <servlet-name>Image</servlet-name>
   <url-pattern>/servlet/Image</url-pattern>
</servlet-mapping>

<servlet-mapping>
   <servlet-name>dwr-invoker</servlet-name>
   <url-pattern>/dwr/*</url-pattern>
</servlet-mapping>

<!-- 加载核心标签库 -->
<jsp-config>
   <taglib>
    <taglib-uri>
    http://www.java.sun.com/jsp/jstl/core
    </taglib-uri>
    <taglib-location>/WEB-INF/jstl/c.tld</taglib-location>
   </taglib>
</jsp-config>

<welcome-file-list>
   <welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<error-page>
   <error-code>404</error-code>
   <location>/404.jsp</location>
</error-page>
<error-page>
   <error-code>503</error-code>
   <location>/500.jsp</location>
</error-page>
<error-page>
   <error-code>500</error-code>
   <location>/500.jsp</location>
</error-page>
</web-app>
分享到:
评论

相关推荐

    项目配置文件( spring-mvc.xml spring-mybatis.xml web.xml log4j.properties)

    这里提到的四个关键配置文件——`spring-mvc.xml`、`spring-mybatis.xml`、`web.xml`以及`log4j.properties`,对于一个基于Java的Web应用来说至关重要,特别是使用Spring MVC和MyBatis框架的时候。接下来,我们将...

    spring无web.xml零配置

    在现代的Spring框架开发中,"spring无web.xml零配置"是一种常见的实践,它通过Java配置(javaconfig)替代了传统的XML配置方式。这种方式使得应用更加灵活,代码更易于理解和维护。下面我们将深入探讨这个主题。 ...

    详解Spring mvc的web.xml配置说明

    在构建基于Spring MVC的Web应用程序时,`web.xml`配置文件扮演着至关重要的角色。它定义了应用程序的行为,包括启动时的初始化、请求处理以及中间件的设置。下面我们将详细探讨`web.xml`中涉及Spring MVC的主要配置...

    spring在web.xml中和在struts中的不同配置..pdf

    在本文中,我们将探讨Spring在`web.xml`中的配置与在Struts中的配置差异,以及这两种配置方式背后的基本原理。 首先,Spring的核心是ApplicationContext,它是一个管理Bean的容器,可以看作是应用程序的上下文环境...

    加载spring 文件,在web.xml中的配置

    在Spring框架中,Web应用程序的配置通常涉及到对`web.xml`文件的设置,这是传统的部署描述符,用于定义Servlet、监听器和其他Web组件。当我们谈论“加载Spring文件,在web.xml中的配置”时,主要是指如何在Web应用...

    SpringMVC基于代码的配置方式(零配置,无web.xml)

    传统的SpringMVC配置往往依赖于XML文件,如web.xml和spring-servlet.xml等,但随着Spring框架的发展,出现了基于代码的配置方式,实现了零XML配置,提高了开发效率。本文将详细介绍如何在不使用web.xml的情况下,...

    Spring全注解project示例 (无web.xml配置)

    3. **无web.xml配置**:在传统的Servlet应用中,web.xml是部署描述符,用于配置Servlet、Filter和Listener等。但在Spring Boot应用中,尤其是使用Spring MVC时,可以借助`@SpringBootApplication`注解启动Spring ...

    Spring在web.xml中的配置详细介绍

    在Java Web应用中,Spring框架的使用已经非常普遍,而web.xml是Java EE标准的web应用配置文件,它用于配置web应用的各种属性。要将Spring框架与web.xml结合使用,需要进行一些特定的配置,从而使得Spring能够管理web...

    struts.xml和applicationContext.xml、web.xml的配置

    在Java Web开发中,`struts.xml`, `applicationContext.xml` 和 `web.xml` 是三个至关重要的配置文件,它们各自负责不同的职责,并协同工作来构建一个完整的应用框架。以下是关于这三个配置文件的详细说明。 首先,...

    web.xml文件中配置(servlet, spring, filter, listenr)的加载顺序

    在`web.xml`中配置Spring时,通常通过Listener来加载Spring容器,这样可以在应用程序启动时初始化所有的Spring Bean。 **示例代码:** ```xml org.springframework.web.context.ContextLoaderListener ...

    spring无web.xml的jdbctemplate配置

    在Spring框架中,传统的Web应用通常会依赖于`web.xml`来配置ApplicationContext,但随着Spring的发展,特别是Spring 3.0引入的JavaConfig配置方式,我们不再需要`web.xml`来初始化Spring容器。本篇文章将深入探讨...

    spring在web.xml中和在struts中的不同配置.[收集].pdf

    本篇文章将深入探讨Spring在`web.xml`中与在Struts中的不同配置方式,以及这两种方式背后的设计思想。 首先,ApplicationContext是Spring的核心组件,它是一个容器,负责管理和装配应用程序中的Bean。在Web应用中,...

    web.xml 配置大全

    - `&lt;context-param&gt;`可以设置Spring的上下文参数,如配置XML配置文件的位置。 9. **Struts2框架集成** - Struts2的配置主要通过`&lt;filter&gt;`和`&lt;filter-mapping&gt;`,定义StrutsPrepareAndExecuteFilter。 10. **JSF...

    Web项目没有web.xml配置文件

    在现代的Web开发中,"Web项目没有web.xml配置文件"是一个常见的现象,尤其是在使用Spring Boot、Spring MVC等框架时。传统的Java Web应用通常依赖于`web.xml`文件来配置Servlet、过滤器、监听器等核心组件,但在最新...

    java解决org.springframework.web.context.ContextLoaderListener

    8. **检查外部配置**:如果你的Web应用依赖于外部配置文件(如`context.xml`或`applicationContext.xml`),确保它们被正确地引用,并且包含在WAR文件中。 总的来说,`org.springframework.web.context....

    在Web应用中web.xml利用Spring配置log4j

    在Web应用中通过web.xml利用Spring配置log4j不仅需要理解web.xml的配置方式,还需要对log4j配置文件有一定的了解,并且需要熟悉Spring框架对log4j的支持。这样配置完成后,可以实现日志记录的集中管理和灵活配置,为...

    web.xml+详细解析.rar

    在Java Web开发中,`web.xml`文件是核心配置文件,它是应用服务器启动时加载的部署描述符,用于定义Web应用程序的结构、配置及行为。本篇将深入探讨`web.xml`的重要概念、元素、属性以及在实际项目中的应用。 1. **...

    spring+shiro+ehcache例子

    在web.xml中配置spring容器的监听器。 2:项目集成springmvc 在web.xml中配置前端控制器 3:项目集成shiro 在web.xml中配置shiro过滤器 4:项目post乱码处理 在web.xml中配置字符过滤器 5:项目运行...

    spring在web.xml中和在struts中的不同配置

    Spring 在 web.xml 中和在 Struts 中的不同配置 在本文中,我们将探讨 Spring 在 web.xml 中和在 Struts 中的不同配置。首先,我们需要了解 Spring 的核心概念之一:ApplicationContext。 ApplicationContext 是 ...

    spring web.xml指定配置文件过程解析

    在Spring框架中,配置文件是不可或缺的一部分,web.xml文件是Spring Web应用程序的核心配置文件。今天,我们将深入探讨Spring web.xml指定配置文件过程解析,通过示例代码来详细介绍这个过程。 概述 在Spring Web...

Global site tag (gtag.js) - Google Analytics