在其他对象属性类型一样情况下,只需要创建一个类,再在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. 性能测试基础---jmeter基础

    ·Jmeter的脚本构成: Jmeter的脚本是由很多不同的组件构成,在Jmeter中,组件可以分为以下几类: ·测试计划: 是默认存在的组件,所有的Jmeter的组件都是依赖于测试计划的. 在这个组 ...

  2. 前几天去电脑城升级了下主机配置(酷睿i3-9100F)

    因为自用电脑配置有点儿低了,前几天路过电脑城正好顺便升级下主机配置. 平时又不玩儿什么游戏,只是简单的使用,于是酷睿i3-9100F就成为了我的选择. 酷睿i3-9100F 四核四线程,不带核显(GP ...

  3. CodeForces 150E: Freezing with Style

    题目传送门:CF150E. 据说这个傻逼题还有一个 \(\log\) 的做法,但是我还不会. 题意简述: 给定一棵 \(n\)(\(2\le n\le 10^5\))个点的树,边有边权. 定义一条路径 ...

  4. phpcms添加https后台分页错误的解决方法

    今天修改一位客户的phpcms网站,他要求添加https,这对ytkah来说是轻车熟路了,但是后台稍微有点问题,点击分页出现错误,将鼠标移到下一页显示的链接是https://www.abc.com/w ...

  5. GIL全局解释器锁及协程

    GIL全局解释器锁 1.什么是GIL全局解释器锁 GIL本质是一把互斥锁,相当于执行权限,每个进程内都会存在一把GIL同一进程内的多线程,必须抢到GIL之后才能使用Cpython解释器来执行自己的代码 ...

  6. 第二阶段冲刺(个人)——six

    今天的计划:选择功能界面的logo.背景与功能选择框的整体设计组合. 昨天做了什么?优化登录.注册信息的填写判断. 困难:无.

  7. 模拟赛 T1 费马小定理+质因数分解+exgcd

    求:$a^{bx \%p}\equiv 1(\mod p)$ 的一个可行的 $x$. 根据欧拉定理,我们知道 $a^{\phi(p)}\equiv 1(\mod p)$ 而在 $a^x\equiv 1 ...

  8. python paramiko与linux的连接

    两种使用paramiko连接到linux服务器的代码 方式一: 1 ssh = paramiko.SSHClient() 2 ssh.set_missing_host_key_policy(param ...

  9. java web开发入门汇总

    servlet 用java语言开发动态资源网站的技术,在doGet方法中拼接显示html,在doPost方法中提交数据.类似于.net的ashx技术. servlet生成的class文件存放在tomc ...

  10. Mysql连接驱动与Java之间的版本不匹配问题(Mysql-connector-java与Java、Mysql版本对应关系)

    一.问题如下: 我使用的是jdk12.0.1,jdk12在使用kettle时找不到能匹配的驱动版本来连接mysql: 我尝试过很多mysql连接驱动版本都直接报错,于是我将jdk版本降到了jdk8,结 ...