//解决BeanUtils不能封装Date类型
ConvertUtils.register(new Converter() {
@Override
public Object convert(Class clazz, Object value) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date parse = null;
try {
if (value.equals("") || value == null) {//如果为空给个默认值
value = "1949-10-1";
}
parse = format.parse(value.toString());
} catch (ParseException e) {
e.printStackTrace();
}
return parse;
}
}, Date.class);
解决BeanUtils不能封装Date类型
最新推荐文章于 2019-08-06 01:58:02 发布