今天在学习sping mvc 的时候遇到了一个问题,就是页面一直报404,后面找了很多文章,后面才发现在我spring-mvc的配置文件里少加了一行
<mvc:annotation-driven/>
简单的说这个的用法,使用配置了spring mvc中的@Controller注解,就必须要配置<mvc:annotation-driven />,否则org.springframework.web.servlet.DispatcherServlet无法找到控制器并把请求分发到控制器。
今天在学习sping mvc 的时候遇到了一个问题,就是页面一直报404,后面找了很多文章,后面才发现在我spring-mvc的配置文件里少加了一行
<mvc:annotation-driven/>
简单的说这个的用法,使用配置了spring mvc中的@Controller注解,就必须要配置<mvc:annotation-driven />,否则org.springframework.web.servlet.DispatcherServlet无法找到控制器并把请求分发到控制器。