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 7 <servlet> 8 <servlet-name>springMvc</servlet-name> 9 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 10 <init-param> 11 <param-name>contextConfigLocation</param-name> 12 <param-value>/WEB-INF/spring.xml</param-value> 13 </init-param> 14 <load-on-startup>1</load-on-startup> 15 </servlet> 16 <servlet-mapping> 17 <servlet-name>springMvc</servlet-name> 18 <url-pattern>/</url-pattern> 19 </servlet-mapping> 20 21 <!-- 配置log4j.xml监听器 --> 22 <listener> 23 <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> 24 </listener> 25 </web-app>