ajaxSubmit 报错 400 (Failed to load resource: the server responded with a status of 400 (Bad Request))
2017-03-28 15:16
639 查看
后台是SpringMVC的,设置了断点也不会被触发。
后来经过测试发现,是表单提交的内容数据类型与实体的(也就是数据表字段)的数据类型不匹配导致的。
在提交表单之前应该对用户输入的内容做验证,后台直接做映射了,没有做内容验证的机会。
不要把生成实体的工作交给MVC框架来完成
这样做就导致上面说过的问题:后台直接做映射了,没有做内容验证的机会;明明一个字段要求数字,结果用户输入了字母或汉字。
在提交表单之前应该对用户输入的内容做验证,后台直接做映射了,没有做内容验证的机会。
不要把生成实体的工作交给MVC框架来完成
@ResponseBody @RequestMapping(value="/createTask",method=RequestMethod.POST) public String createTask(TaskBatch task,HttpServletRequest request ,Model model){ return "true"; }
这样做就导致上面说过的问题:后台直接做映射了,没有做内容验证的机会;明明一个字段要求数字,结果用户输入了字母或汉字。
相关文章推荐
- ajax 报错 400 (Failed to load resource: the server responded with a status of 400 (Bad Request))
- Failed to load resource: the server responded with a status of 400 (Bad Request)
- Failed to load resource: the server responded with a status of 400 (Bad Request)
- Failed to load resource: the server responded with a status of 400 (Bad Request)
- 关于前台jsp页面Failed to load resource: the server responded with a status of 400 (Bad Request)
- 关于使用springmvc时Failed to load resource: the server responded with a status of 400 (Bad Request)错误可能原因
- 关于使用springmvc时Failed to load resource: the server responded with a status of 400 (Bad Request)错误可能原因
- Failed to load resource: the server responded with a status of 400 (Bad Request)
- Failed to load resource: the server responsed with a status of 400 (Bad Request)
- 上传文件失败 Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- SprimgMVC:Failed to load resource: the server responded with a status of 406 (Not Acceptable)
- jquery:Failed to load resource: the server responded with a status of 404 (Not Found)
- PHP 中 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
- Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
- Failed to load resource: the server responded with a status of 406 (Not Acceptable)
- failed to load resource the server responded with a status of 500 (internal server error)
- (springmvc)页面找不到静态资源文件Failed to load resource: the server responded with a status of 404 (Not Found)