web.xml中的各种配置

 <?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <!-- Spring ApplicationContext配置文件的路径�可使用通配符,多个路径用�,号分隔此参数用于后面的Spring-Context loader -->   
    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/classes/log4j.properties</param-value>
    </context-param>
 

    <!--Spring默认刷新Log4j配置文件的间隔,单位为millisecond-->
    <context-param>
        <param-name>log4jRefreshInterval</param-name>
        <param-value>60000</param-value>
    </context-param> 
   
    <!--默认i18n资源文件-->
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>i18n/messages</param-value>
    </context-param>
   
    <!--ExtremeTable 表格标签的 Properties文件-->
    <context-param>
        <param-name>extremecomponentsPreferencesLocation</param-name>
        <param-value>/conf/extremetable.properties</param-value>
    </context-param>
   
    <context-param>
        <param-name>extremecomponentsMessagesLocation</param-name>
        <param-value>i18n/messages</param-value>
    </context-param>
   
<!--Spring ApplicationContext配置文件的路径。可使用通配符,多个路径用逗号分隔。
        此参数用于后面的“Spring-Context loader”-->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:context/*.xml</param-value>
  </context-param>
 
         
    <!--famous Character Encoding filter-->
    <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>
      <filter-name>ecsideExport</filter-name>
      <filter-class>org.ecside.filter.ECSideFilter</filter-class>
      <init-param>
       <param-name>useEasyDataAccess</param-name>
       <param-value>true</param-value>
      </init-param>
      <init-param>
       <param-name>useEncoding</param-name>
       <param-value>true</param-value>
      </init-param>
      <init-param> 
       <param-name>encoding</param-name>
       <param-value>UTF-8</param-value>
      </init-param>     
     </filter>
     
     <filter-mapping>
      <filter-name>ecsideExport</filter-name>
      <url-pattern>/*</url-pattern>
     </filter-mapping>     
       
    <!-- Acegi安全控制 Filter 配置
  用FilterToBeanProxy来代理每个filter request -->
    <filter>
        <filter-name>securityFilter</filter-name>
        <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
        <init-param>
            <param-name>targetClass</param-name>
            <param-value>org.acegisecurity.util.FilterChainProxy</param-value>
        </init-param>
    </filter>
   
    <!--消息filter, 将Session中的messages属性放入request并从session移除
        参见BaseController中的saveMessages()方法使用,用于在Redirect时保留信息-->
    <filter>
        <filter-name>messageFilter</filter-name>
        <filter-class>erp.lib.common.support.web.MessageFilter</filter-class>
    </filter>
      
          
    <!--Open Session in View Filter-->
    <filter>
        <filter-name>hibernateFilter</filter-name>
        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
    </filter>
   
    <!--Log4J filter,将Session中的UserID属性放入Log4j MDC:
        MDC(Mapped Diagnostic Context,线程映射表)输出日志。
         通常用于多个客户端连接同一台服务器, 方便服务器区分是那个客户端访问留下来的日志

        它们用于存储应用程序的上下文信息(context infomation),从而便于在log中使用这些信息。
        MDC内部使用了类似map的机制来存储信息,上下文信息也是每个线程独立地储存,信息是以key值存储在“map”中。
    -->
    <filter>
        <filter-name>log4jMDCUserFilter</filter-name>
        <filter-class>erp.lib.common.support.web.Log4JUserFilter</filter-class>
    </filter>         
   
       
<!--
   限定了FilterToBeanProxy的URL匹配模式,只有*.do和*.jsp和/j_acegi_security_check 的请求才会受到权限控制,
    对javascript,css等不限制。
-->  
   <filter-mapping>
      <filter-name>securityFilter</filter-name>
      <url-pattern>/*</url-pattern> 
   </filter-mapping>

   <filter-mapping>
        <filter-name>messageFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
   
    <!--struts调用-->
    <filter-mapping>
        <filter-name>hibernateFilter</filter-name>
        <url-pattern>*.do</url-pattern>
    </filter-mapping>
   
    <!--spring调用-->
    <filter-mapping>
        <filter-name>hibernateFilter</filter-name>
        <url-pattern>*.action</url-pattern>
    </filter-mapping>
   
    <filter-mapping>
        <filter-name>hibernateFilter</filter-name>
        <url-pattern>/j_acegi_security_check</url-pattern>
    </filter-mapping>
   
   
    <filter-mapping>
        <filter-name>hibernateFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
    </filter-mapping>

    <!--  加上此Mapping, 让xfire也用上open session in view -->
    <filter-mapping>
        <filter-name>hibernateFilter</filter-name>
        <url-pattern>/service/*</url-pattern>
    </filter-mapping>
   
    <filter-mapping>
        <filter-name>log4jMDCUserFilter</filter-name>
        <url-pattern>/admin/*</url-pattern>
    </filter-mapping>     



    <!--Spring Context loader-->
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener> 
  <!--
    HttpSessionEventPublisher用于发布
      HttpSessionApplicationEvents和HttpSessionDestroyedEvent事件给spring的applicationcontext。
  -->
  <listener>
       <listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
  </listener>     

    <!--Spring log4j Config loader-->
  <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
  </listener>


  
     <!-- STRUTS -->
  <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,     
                   /WEB-INF/modules/struts-config-pdm.xml
      </param-value>
    </init-param>
    <init-param> 
           <param-name>debug</param-name> 
           <param-value>2</param-value> 
    </init-param> 
    <init-param> 
           <param-name>detail</param-name> 
           <param-value>2</param-value> 
   </init-param> 
   <load-on-startup>1</load-on-startup>
  </servlet>

    <!--Spring Dispatch Servlet,Spring MVC的入口,按servlet-name, 载入springmvc-servlet.xml -->
  <servlet>
        <servlet-name>springmvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
  </servlet>
   
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>*.action</url-pattern> <!--  注意这里类似于“一个目录与目录下面的所有映射”  -->     
  </servlet-mapping>
   
    <!-- DWR Ajax, 如果没安装plugins/DWR, Tomcat会报错,但不影响运行-->
    <servlet>
        <servlet-name>dwr-invoker</servlet-name>
        <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
        <init-param><!-- 为了安全考虑,在正式环境下你一定把这个参数设为false.-->
            <param-name>debug</param-name>
            <param-value>false</param-value>
        </init-param>
        <!-- 激活轮询和Comet功能 -->
        <init-param>
            <param-name>activeReverseAjaxEnabled</param-name>
            <param-value>true</param-value>
        </init-param>
         <!-- 告诉DWR当程序开始时初始化ReverseAjaxTracker.这会覆盖通常在bean上作第一次请求时的延迟初始化行为:在这里这是很有必要的,
              因为客户端从不在ReverseAjaxTracker上调用方法 -->        
        <init-param>
            <param-name>initApplicationScopeCreatorsAtStartup</param-name>
            <param-value>true</param-value>
        </init-param>
       
        <!--此操作在IE6+以上有BUG,因此屏蔽该选项
        <init-param>
           <param-name>maxWaitAfterWrite</param-name>
           <param-value>500</param-value>
        </init-param>
        -->
       
 <!-- 当值为0或者大于0时,表示容器在应用启动时就加载这个servlet;当是一个负数时或者没有指定时,则指示容器在该servlet被选择时才加载。 -->
        <load-on-startup>1</load-on-startup>
    </servlet>
   


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

    <!--  end of dwr -->

   
    <!--================TagLibrary设置================-->
  <jsp-config>
 
      <taglib>
        <taglib-uri>http://www.springside.org.cn/taglibs</taglib-uri>
        <taglib-location>/WEB-INF/tld/springside.tld</taglib-location>
      </taglib>
      
      <taglib>
        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
      </taglib>
     
      <taglib>
        <taglib-uri>/WEB-INF/commontag.tld</taglib-uri>
        <taglib-location>/WEB-INF/tld/commontag.tld</taglib-location>
      </taglib>
     
      <taglib>
        <taglib-uri>/WEB-INF/struts-menu.tld</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-menu.tld</taglib-location>
      </taglib>

      <taglib>
        <taglib-uri>/WEB-INF/struts-menu-el.tld</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-menu-el.tld</taglib-location>
      </taglib>

        
     
  </jsp-config>
    <!-- jcaptcha 用来生成验证码图片 -->
    <servlet>
        <servlet-name>jcaptcha</servlet-name>
        <servlet-class>erp.plugins.security.jcaptcha.ImageCaptchaServlet</servlet-class>
        <load-on-startup>3</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>jcaptcha</servlet-name>
        <url-pattern>/captcha.jpg</url-pattern>
    </servlet-mapping>
    <!--  end of jcaptcha -->

    <!--session 超时定义-->
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
   

    <!--默认首页定义-->
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

    <!--Error Page定义-->
    <error-page>
        <error-code>500</error-code>
        <location>/errors/error.jsp</location>
    </error-page>
    <error-page>
        <error-code>404</error-code>
        <location>/errors/404.jsp</location>
    </error-page>
    <error-page>
        <error-code>403</error-code>
        <location>/errors/403.jsp</location>
    </error-page>   
</web-app>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值