首页 > Web开发 > 详细

HTTP Status 400 – Bad Request 错误处理

时间:2020-04-01 21:24:22      阅读:68      评论:0      收藏:0      [点我收藏+]

错误描述
前台页面采用spring mvc的form表单进行提交请求,结果页面出现如下错误:

HTTP Status 400 – Bad Request
Type Status Report

Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

 


大致意思是:畸形的请求语法,无效的请求消息帧,欺骗的请求路由


异常原因
400错误信息中包含了错误原因的提示The server cannot or will not process the request due to something that is perceived to be a client\color{red}clientclient error

根据异常提示:一般都是请求有问题(不是server的问题,是程序错误

发出请求的页面

技术分享图片

 

 


处理请求的controller

技术分享图片

 

 


pojo定义

技术分享图片

 

 


前台form表单中的部分参数 和 后台接受的参数类型不一致导致的。即参数名称相同,但是类型不同(比如前天是一般input返回的是String类型,但是后台的属性是int的时候就会除此错误

又比如前台是String类型,后台是一个自定义对象类型的时候会出现此问题)。spring mvc在绑定参数的时候出现异常,导致server返回400错误

解决方法
检查 页面form表单字段与po中属性的名字和类型是否一致



转自:https://blog.csdn.net/write6/article/details/91874691

HTTP Status 400 – Bad Request 错误处理

原文:https://www.cnblogs.com/isme-zjh/p/12615777.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!