//Spring MVC,,两个@RequestMapping是可以运行成功的,但是ViewControllers时候,就提示404错误,求解
@RequestMapping("/index")
public String hello() {
return "index";
}
@RequestMapping("/toUpload")
public String upLoad() {
return "upload";
}
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/index").setViewName("/index");
registry.addViewController("/toUpload").setViewName("/upload");
}
你的addViewControllers是什么时候运行的,有没有执行呢?
http://blog.csdn.net/aini201/article/details/18734245
楼主是怎么解决的啊,我的也出现这个问题啦
spring framework 版本太低,换成4.3.3的就可以了
我也遇到了 我怀疑是addViewController 这个方法 加入的请求只能用get方式访问 用post访问不了
加上
@Bean
public HandlerMapping viewControllerHandlerMapping(){
return super.viewControllerHandlerMapping();
}