最近学习spring mvc 遇到的报错都记录下来,有多少加多少吧
1:
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.
IllegalStateException: Ambiguous mapping found. Cannot map '*****Controller' bean method
搜了几个帖子,大致意思是controller部署的值重复了,检查各个方法的@RequestMapping是否有重复,即可。
2:
最开始以为只要method=RequestMethod.GET,return 的值就可以直接选 /xxx ,指向某一页面,但是跳转到列表时,列表为空,原因也是没考虑到redirect的定义,
redirect是服务端根据逻辑,发送一个状态码,告诉浏览器重新去请求那个地址.所以地址栏显示的是新的URL.当进行数据操作后,还是return redirect 为好。