org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult
说明:
很明显,实体设置的是Date类型,但是页面是以字符串的形式将日期字符串转换为实体字段导致的不匹配。
解决办法:
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
————————————————
版权声明:本文为CSDN博主「fqf_520」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/fqf_520/article/details/50535711

浙公网安备 33010602011771号