在Controller中添加一个数据绑定方法:
注:只在当前Controller中生效
@InitBinder public void initBinder(ServletRequestDataBinder bin){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); CustomDateEditor cust = new CustomDateEditor(sdf,true); bin.registerCustomEditor(Date.class,cust); }