Spring中日期类型的绑定
来源:互联网 发布:网卡mac地址哪个是 编辑:程序博客网 时间:2024/06/03 23:16
首先在action-servlet.xml中配置如下:
<!-- property editor-->
<beanclass="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<propertyname="webBindingInitializer">
<beanclass="com.morris.MyBindingInitializer"/>
</property>
</bean>
Java代码:
package com.spring.demo;
public class MyBindingInitializer implements WebBindingInitializer{
public voidinitBinder(WebDataBinder binder, WebRequest request) {
SimpleDateFormat dateFormat = newSimpleDateFormat("yyyy-MM-dd"); //可以设定任意的日期格式
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class,
new CustomDateEditor(dateFormat, true));
binder.registerCustomEditor(String.class, newStringTrimmerEditor(false));
}
}
<!-- property editor-->
Java代码:
package com.spring.demo;
public class MyBindingInitializer implements WebBindingInitializer{
}
0 0
- Spring中日期类型的绑定
- SQLserver2005 中日期类型的使用全功略
- mysql中日期类型的使用
- Sql中日期类型的比较
- java中日期类型
- Spring MVC中日期转换的错误
- java中日期类型与字符串类型之间的转换
- JAVA中日期类型转换
- java中日期类型详解
- oracle中日期类型与unix 时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- 微软ASP.NET AJAX中日期类型的JSON处理
- C#中日期类型数据的转换格式
- oracle中日期类型与unix 时间戳的转换
- Oracle中日期Date类型格式的转化
- oracle中日期类型与unix 时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- jquery的$符号冲突问题
- Codevs 1506 传话
- java中常用的对象转json
- js 获取 前一个页面的 url
- 去掉 ul 前面的小黑点
- Spring中日期类型的绑定
- jquery根据name获取对象
- 简单的文本读取
- instanceof详解
- ZK 使用 ZK JspTags Q&A
- 在spring中配置hibernate的二级缓…
- BeanPropertyRowMapper类详解
- spring中文api下载
- BeanUtils的copyProperties的效率…