在其他对象属性类型一样情况下,只需要创建一个类,再在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. Codeforces J. Sagheer and Nubian Market(二分枚举)

    题目描述: Sagheer and Nubian Market time limit per test 2 seconds memory limit per test 256 megabytes in ...

  2. BEST FREE UNITY ASSETS – OVER 200 CURATED QUALITY ASSETS

    http://www.procedural-worlds.com/blog/best-free-unity-assets-categorised-mega-list/ BEST FREE UNITY ...

  3. 最全BT磁力搜索引擎索引(整理分享,不断更新...)

    最全BT磁力搜索引擎索引(整理分享,不断更新...) btkitty:http://cnbtkitty.com/(知名的BT磁力搜索,资源很多) idope.se:https://idope.se/( ...

  4. ABP 往前端返回详细的错误信息

    在这个类:MyABP.Web.Startup.MyABPWebMvcModule 中 的 PreInitialize 方法 添加一句: Configuration.Modules.AbpWebComm ...

  5. pytest--命令行常用参数

    前戏 在python中,大家听到最多的单元测试框架就是unittest和pytest了,而pytest有很多的功能,甩unittest几条街 我们在使用pytest时,要遵循pytest的命名规则: ...

  6. 蒟蒻所见之DP

    本文有错是正常的,因为这只是一部成长史,并非教学博文. 会常年更下去. 2019.10.24 DP,核心只是"表格法"而已. DP题真正所考察的,是: 1.对问题的描述.简化以及归 ...

  7. 【JZOJ100207】【20190705】决心

    题目 你需要构造一个排列 初始时\(p_i=i\),一次操作定义为: 选择一些\((x_i,y_i)\),满足每个数字只能出现一次 依次交换\(p_{x_i},p_{y_i}\) 定义一个排列 \(P ...

  8. K8s中的网络

    Kubernetes的网络通信问题: 1. 容器间通信: 即同一个Pod内多个容器间通信,通常使用loopback来实现. 2. Pod间通信: K8s要求,Pod和Pod之间通信必须使用Pod-IP ...

  9. 第02组 Alpha冲刺(1/6)

    队名:無駄無駄 组长博客 作业博客 组员情况 张越洋 过去两天完成了哪些任务 如何进行团队代码的版本管理 如何使用微信云开发 如何使用管理微信开发团队 接下来的计划 沟通前后端成员,监督.提醒他们尽快 ...

  10. 【IntelliJ IDEA学习之九】版本控制之Git和Github

    版本:IntelliJIDEA2018.1.4 [IntelliJ IDEA学习之九]版本控制之Git版本:IntelliJIDEA2018.1.4 一.git知识准备git是目前流行的分布式版本管理 ...