关于No mapping found for HTTP request with URI [访问路径] in DispatcherServlet with dispatche

刚刚搭配好的spingmvc配置访问controller文件夹下的/test路径却发现失败了,访问路径提示404错误,如下图

关于No mapping found for HTTP request with URI [访问路径] in DispatcherServlet with dispatche_第1张图片

而且控制台提示

[WARN][http-nio-8080-exec-42][2018-02-27 13:48:59][org.springframework.web.servlet.DispatcherServlet] - No mapping found for HTTP request with URI [/ssm-test/User/book] in DispatcherServlet with name 'SpringMVC'

下图是我随便写的测试。

关于No mapping found for HTTP request with URI [访问路径] in DispatcherServlet with dispatche_第2张图片

后来才发现是spingmvc的配置文件少了东西,如下图

<mvc:annotation-driven/>

这个是配置注解驱动,可以将request参数与绑定到controller参数上,加上去以后重新加载就发现可以访问了

关于No mapping found for HTTP request with URI [访问路径] in DispatcherServlet with dispatche_第3张图片


你可能感兴趣的:(JAVA)