maven工程web層的web.xml配置文件內容
阿新 • • 發佈:2019-02-11
<?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-web</display-name> <!-- log4j 配置 --> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:properties/log4j.properties</param-value> </context-param> <!-- load log4j --> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <!-- 讀取spring配置檔案 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:xml/spring.xml; classpath:xml/spring-mybatis.xml <!-- ;classpath:xml/spring-job.xml --> </param-value> </context-param> <!-- 設計路徑變數值 --> <context-param> <param-name>webAppRootKey</param-name> <param-value>bridgechart-web.root</param-value> </context-param> <context-param> <param-name>log4jExposeWebAppRoot</param-name> <param-value>false</param-value> </context-param> <!-- Spring字符集過濾器 --> <filter> <filter-name>SpringEncodingFilter</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> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>SpringEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 登入過濾器 --> <filter> <filter-name>PagesFilter</filter-name> <filter-class>com.mmc.d4alc.controller.PagesFilter</filter-class> </filter> <filter-mapping> <filter-name>PagesFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- springMVC核心配置 --> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:xml/spring-mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.mp4</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>login.jsp</welcome-file> </welcome-file-list> <!-- session過期時間--> <session-config> <session-timeout>10</session-timeout> </session-config> <!-- 錯誤跳轉頁面 --> <error-page> <!-- 路徑不正確 --> <error-code>404</error-code> <location>/view/common/404.jsp</location> </error-page> <error-page> <!-- 沒有訪問許可權,訪問被禁止 --> <error-code>405</error-code> <location>/view/common/405.jsp</location> </error-page> <error-page> <!-- 內部錯誤 --> <error-code>500</error-code> <location>/view/common/500.jsp</location> </error-page> </web-app>