服务器,tomcat,网页请求错误400,The request sent by the client was syntactically incorrect的问题
来源:互联网 发布:淘宝网广场舞服装套装 编辑:程序博客网 时间:2024/04/30 12:55
这是今天项目中遇到的一个让我纠结的问题,当时特郁闷,找了半天也没找到原因.最后一点一点的
测试提交数据才慢慢发现其中的端倪,最后也给遇到类似问题的朋友一点建议吧!
我的项目是运用SpringMVC作为控制层,然后是添加页面,页面需要提交一堆数据到服务器,当
写完数据提交的时候,并没有如我想象的那样跳入控制层,而跳入下面页面:
这个让我纠结了,以前都没遇到过,这个错误的原因看描述应该是说,客户端提交的请求在语法有错误,
想了半天,最后想到了,可能是数据传入后台的时候进行绑定出错了,然后发现我提交的数据有两个地方
可能有点问题,一个是date类型,一个是checkbox传入的值,后台对应的是String和boolean型。Date类型
在数据绑定时需要在控制层写类型转换器,然后在我的代码中加了一下代码:
@InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd"); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); }
SimpleDateFormat("yyyy-mm-dd") 中传入的格式一定是前台传过来的格式,然后运行,还是报错,最后发现是checkbox传入的问题,把checkbox的value改为true,后台POJO中
属性类型改为Boolean类型,最后运行成功.
提示:一般出现这个问题,描述已经很清楚了,是因为请求语法问题,用GET方法提交,看看URL中参数格式是不是不正确。不对的加以修改,或者需要转换的就自己写个转换器,如上图中的代码块.具体可以查看SpringMVC的数据绑定知识。
1 0
- 服务器,tomcat,网页请求错误400,The request sent by the client was syntactically incorrect的问题
- The request sent by the client was syntactically incorrect 服务器,tomcat,网页请求错误400,
- The request sent by the client was syntactically incorrect ()问题
- 错误400 The request sent by the client was syntactically incorrect ()的解决
- spring mvc 400,The request sent by the client was syntactically incorrect的问题
- velocity http请求400错误HTTP Status 400 The request sent by the client was syntactically incorrect
- spring MVC 错误The request sent by the client was syntactically incorrect ()的解决
- 错误The request sent by the client was syntactically incorrect的解决
- 错误:The request sent by the client was syntactically incorrect的解决
- 错误The request sent by the client was syntactically incorrect ()的解决
- Spring MVC 错误The request sent by the client was syntactically incorrect ()的解决
- 错误The request sent by the client was syntactically incorrect ()的解决
- 错误The request sent by the client was syntactically incorrect ()的解决
- 错误:The request sent by the client was syntactically incorrect的解决
- spring mvc错误:The request sent by the client was syntactically incorrect的解决
- SpringMVC---400错误The request sent by the client was syntactically incorrect ()
- http 400错误 描述:The request sent by the client was syntactically incorrect
- 错误400-The request sent by the client was syntactically incorrect
- 客户端测量输出文章的宽高方案
- Oracle清除表的高水位线
- spring-jms(activemq实现)使用queue发送消息简单例子
- 对自己之前做过项目所做的一些笔记
- 软件开发:个人与团队是永远的核心
- 服务器,tomcat,网页请求错误400,The request sent by the client was syntactically incorrect的问题
- Linux下svn命令行工具使用简介
- VBS基础篇 - 对象(10) - Wscript对象
- JS生成子节点并且附加ID,name,然后提交表单;
- Houdini下如何安装Arnold
- PHP将XML数据转成数组 例子详细介绍
- oracle归档日志
- 插入排序
- 武汉铮铮建材有限公司离婚律师