web.xml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  3. <display-name>EMS_Weather</display-name>
  4. <!-- 加载Spring配置 -->
  5. <context-param>
  6. <param-name>contextConfigLocation</param-name>
  7. <param-value>classpath:config/spring/spring-base.xml</param-value>
  8. </context-param>
  9. <!-- 加载Log4j配置 -->
  10. <context-param>
  11. <param-name>log4jConfigLocation</param-name>
  12. <param-value>classpath:config/log4j/log4j.properties</param-value>
  13. </context-param>
  14. <!-- 启动Log4j -->
  15. <listener>
  16. <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
  17. </listener>
  18. <!-- 启动Spring -->
  19. <listener>
  20. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  21. </listener>
  22. <!-- 系统初始化 -->
  23. <servlet>
  24. <servlet-name>SystemInitServlet</servlet-name>
  25. <servlet-class>com.persagy.init.SystemInitServlet</servlet-class>
  26. <load-on-startup>0</load-on-startup>
  27. </servlet>
  28. <!-- 解决乱码 -->
  29. <filter>
  30. <filter-name>CharacterEncodingFilter</filter-name>
  31. <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  32. <init-param>
  33. <param-name>encoding</param-name>
  34. <param-value>utf-8</param-value>
  35. </init-param>
  36. </filter>
  37. <filter-mapping>
  38. <filter-name>CharacterEncodingFilter</filter-name>
  39. <url-pattern>/*</url-pattern>
  40. </filter-mapping>
  41. <!-- Spring MVC -->
  42. <servlet>
  43. <servlet-name>SpringMVC</servlet-name>
  44. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  45. <init-param>
  46. <param-name>contextConfigLocation</param-name>
  47. <param-value>classpath:config/spring/spring-mvc.xml</param-value>
  48. </init-param>
  49. <load-on-startup>1</load-on-startup>
  50. </servlet>
  51. <servlet-mapping>
  52. <servlet-name>SpringMVC</servlet-name>
  53. <url-pattern>/Spring/MVC/*</url-pattern>
  54. </servlet-mapping>
  55. </web-app>