spring mvc处理提交的时间类型的参数
2015-02-25 15:52
399 查看
一、只需要在controlller类中加入
[java] view
plaincopyprint?
@InitBinder
protected void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
方法就可以
二、注解方式:
[java] view
plaincopyprint?
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") //取日期时使用
@DateTimeFormat(pattern = "yyyy-MM-dd")//存日期时使用
private Date startTime;
[java] view
plaincopyprint?
@InitBinder
protected void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
方法就可以
二、注解方式:
[java] view
plaincopyprint?
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") //取日期时使用
@DateTimeFormat(pattern = "yyyy-MM-dd")//存日期时使用
private Date startTime;
相关文章推荐
- spring mvc提交日期类型参数
- spring mvc提交日期类型参数
- spring mvc 表单的实体包含时间Date,double等类型的处理
- Flex与As3学习笔记之:Part 3 函数参数、字符串处理、日期与时间类型
- spring mvc提交日期类型参数
- spring mvc 前台到后台 时间类型是怎样处理的?
- spring mvc提交日期类型参数
- form表单序列化提交处理当中的时间类型
- CSharp Tips:调用Win32 API如何处理指针类型的参数(补)
- 小技巧:处理ASP提交的参数是经过GB2312 URL编码的
- zzzzzCSharp Tips:调用Win32 API如何处理指针类型的参数
- 利用System.Windows.Interactivity.dll实现View时间在ViewModel中处理(可带sender、EventArgs参数)
- AJAX JSON中日期类型DateTime格式化的序列化自定义对象以及自定义类型参数的问题处理
- 动态提交表单时,如何获取参数类型
- Effective C# 学习笔记(三十九) 使用Dynamic处理范型参数的运行时类型
- 处理日期和时间数据--日期和时间数据类型
- CSharp Tips:调用Win32 API如何处理指针类型的参数 (转载)
- Documentum中关于日期时间类型字段的特殊处理
- VBA调用DLL,及处理C语言的【char*】类型参数
- 调用Win32 API如何处理指针类型的参数(一)