返回顶部

HTTP Status 400 – Bad Request 错误处理

错误描述
前台页面采用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

posted @ 2020-04-01 20:54  fen斗  阅读(16665)  评论(0编辑  收藏  举报