web.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  5. version="3.1">
  6. <!-- Add Support for Spring -->
  7. <!-- Создает Spring Container, доступный всем сервлетам и фильтрам -->
  8. <context-param>
  9. <param-name>contextConfigLocation</param-name>
  10. <param-value>/WEB-INF/applicationContext.xml</param-value>
  11. </context-param>
  12. <listener>
  13. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  14. </listener>
  15. <!-- Обрабатывает все запросы. Центральное понятие-->
  16. <servlet>
  17. <servlet-name>dispatcher</servlet-name>
  18. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  19. <load-on-startup>1</load-on-startup>
  20. </servlet>
  21. <servlet-mapping>
  22. <servlet-name>dispatcher</servlet-name>
  23. <url-pattern>*.form</url-pattern>
  24. </servlet-mapping>
  25. <servlet-mapping>
  26. <servlet-name>dispatcher</servlet-name>
  27. <url-pattern>/</url-pattern>
  28. </servlet-mapping>
  29. <filter>
  30. <filter-name>encodingFilter</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. <init-param>
  37. <param-name>forceEncoding</param-name>
  38. <param-value>true</param-value>
  39. </init-param>
  40. </filter>
  41. <filter-mapping>
  42. <filter-name>encodingFilter</filter-name>
  43. <url-pattern>/*</url-pattern>
  44. </filter-mapping>
  45. </web-app>