在web.xml中配置以下内容
1 <!-- 配置Spring MVC DispatcherServlet --> 2 <servlet> 3 <servlet-name>MVC</servlet-name> 4 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 5 <!-- 初始化参数 --> 6 <init-param> 7 <!-- 加载SpringMVC的xml到 spring的上下文容器中 --> 8 <param-name>contextConfigLocation</param-name> 9 <param-value> 10 /WEB-INF/classes/mvc*.* 11 </param-value> 12 </init-param> 13 <load-on-startup>1</load-on-startup> 14 </servlet> 15 16 <!-- 配置DispatcherServlet所需要拦截的 url --> 17 <servlet-mapping> 18 <servlet-name>MVC</servlet-name> 19 <url-pattern>*.html</url-pattern> 20 </servlet-mapping>