您的位置:首页 > 编程语言 > Java开发

spring mvc 常见错误以及错误原因

2015-12-09 22:19 597 查看
本人在使用spring mvc 中遇到的常见的错误以及出现原因如下:

错误一 如图(1) 所示:

http Status 400 The request sent by the client was syntactically incorrect




图(1)

出现原因有:

① model与(输入)View 类型不匹配,
例如在Model 中定义的是 int ,而在(输入)View 中传入的是字符串或者其他 不匹配类型,



错误二: 如图(2) 所示:

The resoure identified by this request is only capable of generating responses with characeristics
not acceptable accoding to the rquest "accept" hearders


图(2)

出现原因: ① 在spring-servlet.xml 文件中 缺少 <mvc:annotation-driven/>

② 请求controller header(浏览器或者程序)中的accpet与controller中的不匹配

出现以上错误的原因有很多,正在持续更新中.....
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: