在其他对象属性类型一样情况下,只需要创建一个类,再在springmvc.xml中添加配置:

package com.ujiuye.common;

import org.springframework.core.convert.converter.Converter;

import java.text.SimpleDateFormat;
import java.util.Date; public class DateTimeConverter implements Converter<String, Date> {
public Date convert(String s) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try{
Date date = sdf.parse(s);
return date;
}catch (Exception ex){
System.out.println(ex.getMessage());
return null;
}
}
}
<!--全局类型转型器-->
<bean id="converter" class="com.ujiuye.common.DateTimeConverter"></bean>
<bean id="formattingConversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
<property name="converters">
<set>
<ref bean="converter"></ref>
</set>
</property>
</bean>
<mvc:annotation-driven conversion-service="formattingConversionService"/> <mvc:annotation-driven/>

SpringMVC中的400错误,The request sent by the client was syntactically incorrect.的更多相关文章

  1. SpringMVC---400错误The request sent by the client was syntactically incorrect ()

    在SpringMVC中使用@RequestBody和@ModelAttribute注解时遇到了很多问题,现记录下来. @ModelAttribute这个注解主要是将客户端请求的参数绑定参数到一个对象上 ...

  2. HTTP Status 400 - description The request sent by the client was syntactically incorrect.

    HTTP Status 400 - type Status report message description The request sent by the client was syntacti ...

  3. 错误400-The request sent by the client was syntactically incorrect

    springMVC中,某个页面提交时报400错误,如下图.     解决方法: 1.在网上找了一下,答案是通常遇到这个错误是因为前端jsp页面的控件名称和controller中接收的参数名称不一致.但 ...

  4. 错误The request sent by the client was syntactically incorrect ()的解决

    http://www.cnblogs.com/xiandedanteng/p/4168609.html 这个错误是SpringMVC报出来的,见到它意味着html/jsp页面的控件名称 和 contr ...

  5. 错误:The request sent by the client was syntactically incorrect的解决

    问题: 错误400-The request sent by the client was syntactically incorrect. springMVC中,某个页面提交时报400错误,如下图. ...

  6. SpringMVC报错The request sent by the client was syntactically incorrect ()

    springmvc数据绑定出的错 在数据绑定的时候一定要主意Controller方法中的参数名和jsp页面里的参数名字是否一致或者按照绑定的规范来写, 如果不一致,可能回报如下错误: The requ ...

  7. The request sent by the client was syntactically incorrect.

    HTTP Status 400 - type Status report message description The request sent by the client was syntacti ...

  8. 又见The request sent by the client was syntactically incorrect ()

    前几天遇到过这个问题(Ref:http://www.cnblogs.com/xiandedanteng/p/4168609.html),问题在页面的组件name和和注解的@param名匹配不对,这个好 ...

  9. The request sent by the client was syntactically incorrect问题解决

    The request sent by the client was syntactically incorrect意思嘛,google翻译一下 通过日志不难看出,是由参数不匹配造成的. 所以对于Da ...

  10. spring mvc 在上传图片时,浏览器报The request sent by the client was syntactically incorrect

    项目中,在一个jsp页面里其它图片上传是功能是可以使用的,当我自己新加了一个图片上传时,提交表单后,浏览器报The request sent by the client was syntactical ...

随机推荐

  1. 目标检测论文解读12——RetinaNet

    引言 这篇论文深刻分析了one-stage的模型精度比two-stage更差的原因,并提出Focal Loss提高精度. 思路 在论文中,作者指出,造成one-stage模型精度差的原因主要是:正负样 ...

  2. Activiti6 查询由某人发起的流程请求 设置流程发起人

    发起流程时,配置activiti:initiator属性,并且在代码中: Authentication.setAuthenticatedUserId(userId); 其中,userId对应流程发起人 ...

  3. vs2017 curl7.6编译

    nmake /f Makefile.vc mode=static VC=15 MACHINE=x86 nmake /f Makefile.vc mode=dll VC=15 MACHINE=x86 c ...

  4. 201800624模拟赛T2——回家路上

    题目描述 很多学生都抱怨浪费在回家路上的时间太长.这天dongdong刚走出学校大门,就听说某段路在施工(但不知道是哪条路),有可能导致他回家的时间会变长. Dongdong给出了一张地图,图中标号为 ...

  5. 20-C#笔记-接口

    # 1 接口的使用示例 使用interface,关键字 接口的实现和使用,和继承类似. 在使用之前,要实现接口. using System; interface IMyInterface { // 接 ...

  6. 排序算法-计数排序(Java)

    package com.rao.sort; import java.util.Arrays; /** * @author Srao * @className CountSort * @date 201 ...

  7. git crate&query&delete tag(九)

    root@vmuer-VirtualBox:/opt/myProject# git log --pretty=oneline0169b7a1c4bccb47e76711f353fd8d3864bde9 ...

  8. django-debug-toolbar调试请求接口

    第一步: pip install django-debug-toolbar 安装完成,往下继续配置. 第二步: 打开项目,找到settings.py 文件.  找到: INSTALLED_APPS-- ...

  9. Java 并发系列之一:java 并发体系

    1.  java 并发机制的底层原理实现 1.1 volatile 1.2 synchronized 1.3 原子操作 2. java 内存模型(JMM) 3. java并发基础线程 4. java ...

  10. git使用问题与技巧

    1.修改gitolite管理员 如果gitolite原来的管理员已经没了,那么需要把当前的公钥放到服务器覆盖,然后替换目录下.ssh/authorized_keys内容 2.clone报告超过限制 w ...