Tomcat加载应用程序配置文件顺序(4)

<context-param> 
    <param-name>ContextParameter</para-name> 
    <param-value>test</param-value> 
    <description>It is a test parameter.</description> 
  </context-param>

2、过滤器配置

<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>/*</url-pattern> 
    </filter-mapping> 

3、监听器配置

<listener> 
      <listerner-class>listener.SessionListener</listener-class> 
  </listener>

4、servlet配置
 <servlet>
  <servlet-name>springMVC</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <init-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>classpath:springMVC.xml,classpath:applicationContext.xml</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>springMVC</servlet-name>
  <url-pattern>/</url-pattern>
 </servlet-mapping>   

5、回话超时设置

<session-config> 
      <session-timeout>120</session-timeout> 
  </session-config>


6、MIME类型配置 

<mime-mapping> 
      <extension>htm</extension> 
      <mime-type>text/html</mime-type> 
  </mime-mapping> 

7、指定欢迎页配置

<welcome-file-list> 
      <welcome-file>index.jsp</welcome-file> 
      <welcome-file>index.html</welcome-file> 
      <welcome-file>index.htm</welcome-file> 
  </welcome-file-list> 

8、配置错误页面配置

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/8d1719253b62616eae37276a1a90fb80.html