spring mvc @initBinder 使用
格式化日期: yyyy-MM-dd HH:mm
指定 ArticleEntity 中 publishDate 属性
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, "publishDate", new CustomDateEditor(dateFormat, false));
}