web.xml中配置:
springmvc
org.springframework.web.servlet.DispatcherServlet
1
springmvc
/
分析原因:
因为mapping使用的是/ 默认拦截所有。
解决方案:
在spring-mvc的配置文件中添加:
提示:
如果添加了 提示错误信息
The prefix "mvc" for element "mvc:annotation-driven" is not bound.
解决方案:
在bean添加如下:
xmlns:mvc="http://www.springframework.org/schema/mvc"
在 xsi:schemaLocation中添加:
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd