maven工程web层的web.xml配置文档内容

下面是web层,web.xml配置文档里面需要配置的东西:

1、lo4j配置

2、读取spring文件配置

3、设计路径变量值

4、spring字符集过滤器

5、登陆过滤器

6、springMVC核心配置

7、session过期时间

8、错误页面跳转




以下是实例:

复制代码
xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <display-name>bridgechart-webdisplay-name>

    
    <context-param>
        <param-name>log4jConfigLocationparam-name>
        <param-value>classpath:properties/log4j.propertiesparam-value>
    context-param>
    
    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListenerlistener-class>
    listener>
    
    <context-param>
        <param-name>contextConfigLocationparam-name>
        <param-value>classpath:xml/spring.xml;
            classpath:xml/spring-mybatis.xml
            
        param-value>
    context-param>
    
    <context-param>
        <param-name>webAppRootKeyparam-name>
        <param-value>bridgechart-web.rootparam-value>
    context-param>
    <context-param>
        <param-name>log4jExposeWebAppRootparam-name>
        <param-value>falseparam-value>
    context-param>
    
    <filter>
        <filter-name>SpringEncodingFilterfilter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilterfilter-class>
        <init-param>
            <param-name>encodingparam-name>
            <param-value>UTF-8param-value>
        init-param>
        <init-param>
            <param-name>forceEncodingparam-name>
            <param-value>trueparam-value>
        init-param>
    filter>
    <filter-mapping>
        <filter-name>SpringEncodingFilterfilter-name>
        <url-pattern>/*url-pattern>
    filter-mapping>
    
    
    <filter>
        <filter-name>PagesFilterfilter-name>
        <filter-class>com.mmc.d4alc.controller.PagesFilterfilter-class>
    filter>
    <filter-mapping>
        <filter-name>PagesFilterfilter-name>
        <url-pattern>/*url-pattern>
    filter-mapping>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListenerlistener-class>
    listener>

    
    <servlet>
        <servlet-name>springservlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServletservlet-class>
        <init-param>
            <param-name>contextConfigLocationparam-name>
            <param-value>classpath:xml/spring-mvc.xmlparam-value>
        init-param>
        <load-on-startup>1load-on-startup>
    servlet>
    <servlet-mapping>
        <servlet-name>springservlet-name>
        <url-pattern>/url-pattern>
    servlet-mapping>
    <servlet-mapping>
        <servlet-name>defaultservlet-name>
        <url-pattern>*.mp4url-pattern>
    servlet-mapping>

    <welcome-file-list>
        <welcome-file>login.jspwelcome-file>
    welcome-file-list>
    
  
  
  <session-config>
      <session-timeout>10session-timeout>
  session-config>
  
    
    <error-page>
        
        <error-code>404error-code>
        <location>/view/common/404.jsplocation>
    error-page>
    <error-page>
        
        <error-code>405error-code>
        <location>/view/common/405.jsplocation>
    error-page>
    <error-page>
        
        <error-code>500error-code>
        <location>/view/common/500.jsplocation>
    error-page>
web-app>
复制代码

你可能感兴趣的:(maven工程web层的web.xml配置文档内容)