SpringMVC - 问题. No mapping found for HTTP request with URI
2014-08-13 10:07
225 查看
<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/>
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 问题
- SpringMVC资源无法找到(No mapping found for HTTP request with URI)问题解决
- 完美解决SpringMVC中静态资源无法找到(No mapping found for HTTP request with URI)问题
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决--转载
- 在写springmvc整合hibernate的时候报警告No mapping found for HTTP request with URI的原因
- mark springmvc [No mapping found for HTTP request with URI]
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决(转)
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- No mapping found for HTTP request with URI 找不到图片或者其他的静态资源问题解决办法
- 【Spring】Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- springMVC--关于no mapping found for http request with uri
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- springMVC报WARNING: No mapping found for HTTP request with URI [/springMVC/hello] in DispatcherServle
- SpringMvc4.2.5 零配置出现 No mapping found for HTTP request with URI
- No mapping found for HTTP request with URI问题
- 静态资源无法找到(No mapping found for HTTP request with URI)问题