HTTP Status 400 – Bad Request 错误处理
HTTP request status 错误处理 Bad 400
2023-09-27 14:21:42 时间
错误描述
前台页面采用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
相关文章
- TCP/IP网络协议的通俗理解,SOCKET,HTTP,SOAP
- Laravel通过request表单验证类返回封装http状态码
- 深入浅出:HTTP/2
- 计算机网络安全基础知识2:http超文本传输协议,请求request消息的get和post,响应response消息的格式,响应状态码
- 初识 HTTP/2(一)
- git克隆源码时提示fatal: HTTP request failed怎么办?
- 微信小程序class封装http
- 不安全的HTTP方法
- HTTP状态码总结
- 高并发系统之HTTP缓存
- Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock32 error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
- https下 http的会被阻塞 This request has been blocked; the content must be served over HTTPS.
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决--转载