当前位置: 代码迷 >> Web前端 >> springmvc-web.xml详解(一)
  详细解决方案

springmvc-web.xml详解(一)

热度:1160   发布时间:2013-12-29 13:07:03.0
springmvc-web.xml详解(1)
<div class="iteye-blog-content-contain" style="font-size: 14px">
原博客地址:http://liuxuan1106.blog.163.com/blog/static/15691196200910623742942/
<?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/j2ee" xmlns:javaee="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/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
    <!--定义了WEB应用的名字-->
<display-name>tp-qamp</display-name>
         <!--声明WEB应用的描述信息-->
         <description></description>
          <!-context-param元素声明应用范围内的初始化参数-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:context/applicationContext.xml
</param-value>
</context-param>
       <!- 监听器配置-->
<listener>
<listenerclass>
                     org.springframework.web.context.ContextLoaderListener
              </listener-class>
</listener>
<listener>
<listenerclass>
                  org.springframework.web.util.IntrospectorCleanupListener
              </listener-class>
</listener>
<!--如果servlet里面不配置配置文件地址,默认找/WEB-INF/[servletName]-servlet.xml -->
<servlet>
<servlet-name>QampMvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:context/framework/mvc/mvc-context.xml</param-value>
</init-param>
<!-- web启动就初始化servlet,加载spring application配置文件,完成对象实例化 -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>QampMvc</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encoding</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>processTime</filter-name>
<filter-class>com.bill99.riaframework.web.filter.ProcessTimeFilter</filter-class>
</filter>
<filter>
<filter-name>osivFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<listener>
<listener-class>com.bill99.riaframework.web.listener.SystemInitListener</listener-class>
</listener>
<filter-mapping>
<filter-name>processTime</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>osivFilter</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>processTime</filter-name>
<url-pattern>*.jspx</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>*.jspx</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>osivFilter</filter-name>
<url-pattern>*.jspx</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>processTime</filter-name>
<url-pattern>*.jhtml</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>*.jhtml</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>osivFilter</filter-name>
<url-pattern>*.jhtml</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>processTime</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>osivFilter</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>processTime</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>osivFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>480</session-timeout>
</session-config>
<error-page>
<error-code>403</error-code>
<location>/WEB-INF/error/403.html</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/404.html</location>
</error-page>
<mime-mapping>
<extension>rar</extension>
<mime-type>application/zip</mime-type>
</mime-mapping>
<mime-mapping>
<extension>doc</extension>
<mime-type>application/zip</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
</web-app>
</div>
  相关解决方案