POST 400 Bad Request The request sent by the client was syntactically incorrect

简介: 最近在做Web开发的时候,使用$.post提交数据,但是回调函数却没有被触发,按F12看控制台输出是:POST *** 400 Bad Request后台是SpringMVC的,设置了断点也不会被触发。

最近在做Web开发的时候,使用$.post提交数据,但是回调函数却没有被触发,按F12看控制台输出是:POST *** 400 Bad Request

后台是SpringMVC的,设置了断点也不会被触发。

后来查看JQuery资料了解到,$.post提交数据只有成功时才触发回调函数,于是改用$.ajax提交数据,添加error回调函数,得到错误信息了,如下图:


这个问题是什么原因造成的呢?

后来经过测试发现,是表单提交的内容数据类型与实体的(也就是数据表字段)的数据类型不匹配导致的。

在提交表单之前应该对用户输入的内容做验证,后台直接做映射了,没有做内容验证的机会。


目录
相关文章
|
17天前
|
应用服务中间件 Apache
消息 Request method ‘POST‘ not supported
消息 Request method ‘POST‘ not supported
|
4月前
|
JSON 数据格式
axios.post请求出错:Request header field content-type is not allowed by Access-Control-Allow-Headers in……
axios.post请求出错:Request header field content-type is not allowed by Access-Control-Allow-Headers in……
|
5月前
request.getParameter、request.getParameterValues、request.getParameterMap用法
request.getParameter、request.getParameterValues、request.getParameterMap用法
|
6月前
|
应用服务中间件 开发工具 nginx
【git】解决:error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
【git】解决:error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
165 0
|
应用服务中间件 API nginx
解决跨域问题 Response to preflight request doesn't pass access control check
解决跨域问题 Response to preflight request doesn't pass access control check
8926 0
|
SQL 关系型数据库 MySQL
【解决思路】HTTP Status 500 Type Exception ReportMessage Request processing failed; 【已解决】
经常测试的一个网页,突然报错500。前面也没有发生过,但突然报错,只能先改错了,不然都没法进入页面。为什么会调用到存在bug的语句,而以前没有发生这种情况?这一问题没能想清楚,只能归咎于编译器了。
297 0
【解决思路】HTTP Status 500 Type Exception ReportMessage Request processing failed; 【已解决】
|
应用服务中间件
returned a response status of 405 Method Not Allowed
returned a response status of 405 Method Not Allowed
returned a response status of 405 Method Not Allowed
|
开发工具 git
解决:The requested URL returned error: 403
今天在 arm 架构的服务器上创建工程时,遇到了一个报错,执行的命令如下: git clone git.liuzhen007.com/boffmpeg.gi… 报错信息如下: fatal: unable to access 'git.liuzhen007.com/boffmpeg.gi…': The requested URL returned error: 403
2232 0