SpringMVC字段验证返回400错误码
来源:互联网 发布:软件项目验收确认书 编辑:程序博客网 时间:2024/05/29 18:01
错误信息
HTTP Status 400 – Bad RequestType Status ReportDescription 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).
错误原因
如果一个方法中有参数被 @Valid 标注了,但该参数后面没有紧跟一个 BindingResult 类型的参数,那么提交到该方法时,将返回 400 错误。
解决方法
//@Valid后跟个JavaBean,紧跟其后的参数必定是BindingResult@RequestMapping("doLogin")private String doLogin(@Valid LoginBean loginBean, BindingResult bindingResult, Model model) { return null;}
SpringMVC整合Fastjson
<mvc:annotation-driven> <mvc:message-converters register-defaults="true"> <!-- 配置Fastjson 替换原来的jackson支持 --> <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> <value>application/json</value> </list> </property> </bean> </mvc:message-converters> </mvc:annotation-driven>
阅读全文
0 0
- SpringMVC字段验证返回400错误码
- 【解决】springmvc 前台表单提交数据返回400错误
- springmvc前段字段和后台返回字段不一致报错
- Linux启动Tomcat返回JRE_HOME字段错误
- springmvc @ResponseBody 返回json数据错误
- SpringMVC 类型转换错误自定义返回
- SpringMVC返回JSON时406错误
- springmvc 返回 json报406错误
- SpringMVC返回JSON数据406错误处理
- springmvc @ResponseBody 返回json数据错误
- SPRINGMVC返回JSON格式 406错误
- springmvc返回路径错误的问题
- 解决springmvc 返回JSON报406错误
- SpringMVC中返回Json时间字段格式问题
- SpringMVC查询返回集合,不能自定义字段对象的解决方法
- 关于springmvc 返回json数据null字段的显示问题
- SpringMvc生成验证码
- springmvc 生成验证码
- vue入门
- 商城项目:maven项目依赖was cached in the local repository错误
- jQuery中this与$(this)的区别
- Android源码编译(四)系统源码目录
- 欢迎使用CSDN-markdown编辑器
- SpringMVC字段验证返回400错误码
- windows bat批处理基础命令学习教程
- 于频率域生成拉普拉斯滤波器
- 分布式作业框架elastic-job
- ArcEngine实现拓扑检查
- 数据嗨客 | 第3期:朴素贝叶斯和垃圾邮件过滤 机器学习 2016-11-01 0 摘要:概率论只不过是把常识用数学公式表达了出来。 概率论只不过是把常识用数学公式表达了出来。 —
- 常见的css3动画样式
- 数组越界异常
- JSP九大内置对象详解分析