web.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  4. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  5. version="2.5">
  6. <!-- 默认的spring配置文件是在WEB-INF下的applicationContext.xml -->
  7. <listener>
  8. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  9. </listener>
  10. <context-param>
  11. <param-name>contextConfigLocation</param-name>
  12. <param-value>
  13. classpath*:applicationContext*.xml
  14. </param-value>
  15. </context-param>
  16. <!-- 日志配置文件 -->
  17. <context-param>
  18. <param-name>log4jConfigLocation</param-name>
  19. <param-value>classpath:log4j.properties</param-value>
  20. </context-param>
  21. <!-- springMVC的核心控制器 -->
  22. <servlet>
  23. <servlet-name>springMVC</servlet-name>
  24. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  25. <init-param>
  26. <param-name>contextConfigLocation</param-name>
  27. <param-value>classpath*:springMVC-servlet.xml</param-value>
  28. </init-param>
  29. <load-on-startup>1</load-on-startup>
  30. </servlet>
  31. <servlet-mapping>
  32. <servlet-name>springMVC</servlet-name>
  33. <url-pattern>/</url-pattern>
  34. </servlet-mapping>
  35. <!-- shiroFilter : DelegatingFilterProxy作用是自动到spring容器查找名字为shiroFilter(filter-name)的bean并把所有Filter的操作委托给它。然后将shiroFilter配置到spring容器即可 -->
  36. <!--<filter>-->
  37. <!--<filter-name>shiroFilter</filter-name>-->
  38. <!--<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>-->
  39. <!--<init-param>-->
  40. <!--<param-name>targetFilterLifecycle</param-name>-->
  41. <!--<param-value>true</param-value>-->
  42. <!--</init-param>-->
  43. <!--</filter>-->
  44. <!--<filter-mapping>-->
  45. <!--<filter-name>shiroFilter</filter-name>-->
  46. <!--<url-pattern>/*</url-pattern>-->
  47. <!--</filter-mapping>-->
  48. <!-- session配置 -->
  49. <session-config>
  50. <session-timeout>30</session-timeout>
  51. </session-config>
  52. <!-- 欢迎页面 -->
  53. <welcome-file-list>
  54. <welcome-file>index.html</welcome-file>
  55. <welcome-file>index.jsp</welcome-file>
  56. </welcome-file-list>
  57. <!-- 错误页面 -->
  58. <error-page>
  59. <error-code>403</error-code>
  60. <location>/WEB-INF/jsp/403.jsp</location>
  61. </error-page>
  62. <error-page>
  63. <error-code>404</error-code>
  64. <location>/WEB-INF/jsp/404.jsp</location>
  65. </error-page>
  66. <error-page>
  67. <error-code>500</error-code>
  68. <location>/WEB-INF/jsp/500.jsp</location>
  69. </error-page>
  70. <error-page>
  71. <exception-type>java.lang.Throwable</exception-type>
  72. <location>/WEB-INF/jsp/error.jsp</location>
  73. </error-page>
  74. </web-app>