(一)SpringMVC之警告: No mapping found for HTTP request with URI

这个警告往往是因为url路径不正确。

所以从三个地方下手:

1、springmvc-config.xml中的配置handle,看看是不是因为handle没有配置导致的。

2、如果是使用注解的方式的话,可以在controller类中查看,controller类的上面的RequestMapping注解的value值跟url的是否匹配,controller类方法的RequestMapping注解的value是否与url的匹配,在写url的是不是按照localhost:8080/{project.name}/{class.annotation}/{method.annotation}的格式,如果类上面没有注解,class.annotation可省略。

3、在xml中的定位springmvc-config.xml的配置:

<init-param>
<!-- 定位spring mvc的配置文件 -->
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springmvc-config.xml</param-value>
</init-param>

猜你喜欢

转载自www.cnblogs.com/NYfor2018/p/9129195.html