标签:style blog http color io ar strong for sp
转载自:http://blog.sina.com.cn/s/blog_534f69a00101332u.html
1.问题:
No mapping found for HTTP request with URI
出现这个问题的原因是在web.xml中配置错了,如:
<servlet>
<servlet-name>springMVCDispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springMVC-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMVCDispatcherServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
2.分析:
当你在control中返回一个路径的时候,它又把路径(/view/index.jsp)当作一个请求被dispatcherServlet所拦截。所以会抛出异常,解决的办法有两个:
3.解决:
第一即使让dispatcherServlet的拦截加上后缀如:*.do;
这样以jsp后缀的就不会别拦截了。
第二个方法是在spring-servlet.xml中加入:
<mvc:default-servlet-handler/>
springMVC No mapping found for HTTP request with URI
标签:style blog http color io ar strong for sp
原文地址:http://www.cnblogs.com/rojas/p/3990177.html