SpringMVC - 问题. No mapping found for HTTP request with URI
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/html/" />
<property name="suffix" value=".html" />
</bean>
这个配置用于SpringMVC跳转控制。
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/spring-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
如果是静态资源如 css js html... 。InternalResourceViewResolver 不会解析资源,而是当作一个url被DispatcherServlet 拦截到..
如
@RequestMapping(value = "/")
public String login() {
return "login";
}
localhost:8080/demo/login.html 这时就会报 No mapping found for HTTP request with URI
解决办法
<mvc:default-servlet-handler/>
SpringMVC - 问题. No mapping found for HTTP request with URI,,5-wow.com
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。