SpringMVC报错The request sent by the client was syntactically incorrect ()
springmvc数据绑定出的错
在数据绑定的时候一定要主意Controller方法中的参数名和jsp页面里的参数名字是否一致或者按照绑定的规范来写,
如果不一致,可能回报如下错误:
The request sent by the client was syntactically incorrect ().
从字面上理解是:客户端发送的请求语法错误。
实际就是springmvc无法实现数据绑定。
查看一下你传的参数是不是有date类型等Springmvc不支持参数绑定的类型,需自己绑定
date时间类型绑定 String-->date
String--> date 时间格式
1 package com.online.util; 2 3 import java.text.ParseException; 4 import java.text.SimpleDateFormat; 5 import java.util.Date; 6 import java.util.Locale; 7 8 import org.springframework.format.Formatter; 9 10 public class DateFormatter implements Formatter<Date>{ 11 12 13 public String print(Date object, Locale locale) { 14 return null; 15 } 16 17 public Date parse(String text, Locale locale) throws ParseException { 18 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 19 Date date = null; 20 try { 21 date = format.parse(text); 22 } catch (Exception e) { 23 format = new SimpleDateFormat("yyyy-MM-dd"); 24 date = format.parse(text); 25 } 26 return date; 27 } 28 }
在Spring的applicationContext.xml中注入这个类
1 <!-- 时间类型转换 --> 2 <bean id="conversionService" 3 class="org.springframework.format.support.FormattingConversionServiceFactoryBean"> 4 <property name="formatters"> 5 <set> 6 <bean class="com.online.util.DateFormatter"></bean> 7 </set> 8 </property> 9 </bean>
在Springmvc.xml中使用 mvc:annotation-driven注解配置
1 <mvc:annotation-driven conversion-service="conversionService"/>
转载于:https://www.cnblogs.com/cmyxn/p/5895093.html
SpringMVC报错The request sent by the client was syntactically incorrect ()相关推荐
- Spring MVC报错:The request sent by the client was syntactically incorrect ()
springmvc数据绑定是一个很好的东西,在数据绑定的时候一定要主意Controller方法中的参数名和jsp页面里的参数名字是否一致或者按照绑定的规范来写,如果不一致,可能会报如下错误: The ...
- The request sent by the client was syntactically incorrect. 错误以及spring事物
mark一下: 1. 今天在做delete的时候不知道为什么hibernate一直就是不执行delete语句,查了好久没有查出来,最后想想是不是事物的问题,于是打开spring的配置文件看了看,哎 ...
- 错误400-The request sent by the client was syntactically incorrect
前端接收服务器发送过来的实体类中含有日期类型或者后台是以对象的方式接收数据且对象中包含有日期类型 报错:错误400-The request sent by the client was syntact ...
- 又见The request sent by the client was syntactically incorrect ()
前几天遇到过这个问题(Ref:http://www.cnblogs.com/xiandedanteng/p/4168609.html),问题在页面的组件name和和注解的@param名匹配不对,这个好 ...
- 错误The request sent by the client was syntactically incorrect ()的解决
2019独角兽企业重金招聘Python工程师标准>>> 这个错误是SpringMVC报出来的,见到它意味着html/jsp页面的控件名称 和 controller里函数的参数不符. ...
- Spring MVC:The request sent by the client was syntactically incorrect
一般是由于参数类型不正确所致.比如表单如下: <form:form action="" method="post" commandName="s ...
- java程序连接MinIO 报错The request signature we calculated does not match the signature you provided.
java程序连接MinIO 报错The request signature we calculated does not match the signature you provided. Check ...
- VUE+Spring Boot,文件上传el-upload报错--Current request is not a multipart request,记录
做了个简单的文件上传功能,测试时发现报错Current request is not a multipart request,网上查了很多办法,记录一下: 1.最多的:当前请求不是multipart ...
- kibana报错:Request must contain a kbn-xsrf header.
kibana报错:Request must contain a kbn-xsrf header. 通过HTTP的DELETE 删除method,清除kibana的数据视图data_view时候 htt ...
最新文章
- 语言 全排列 函数_Power Query 中日期时间格式转换需要了解的区域语言对照表
- PaddleHub 口罩检测
- Spring Boot和Angular 2入门食谱
- [Leetcode][第696题][JAVA][计算二进制子串][分组]
- java 分治法排序_分治法实现1-N的数字按字典序全排列组合 Java语言
- Java多组输入实现 C++多组输入实现
- 安装laravel8
- android 锁屏代码分析,Android锁屏状态下的安全分析
- 成都拉升12名,长沙提升3位,最新全球城市排名出炉
- CENTOS上的时间/时区设定
- 双十一特辑:Python采集商品数据,实时了解商品价格
- eNSP第三篇:STP,生成树,xSTP,MSTP,多生成树,交换机工作原理,环路的形成
- 太阳表面的重力加速度
- C端和B端的差异分析
- ipython出现键盘输入错乱问题
- Python 实战系列-微信或网页远程控制电脑
- sitecore开发入门Sitecore的CRUD操作 - 第一部分
- 2023年5月产品经理认证NPDP线上班,我要报名学习
- 跨境电商一站式数字化管理ERP系统,帮你解决烦恼
- 数据传输完整性_制造系统数据完整性的特殊性(二)