Date提交HTTP POST时必须绑定。Spring不知道这是一个
Date,它将它视为一个
String。
添加:
@InitBinderpublic void initBinder(WebDataBinder binder) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); sdf.setLenient(true); binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true));}给您的控制器。



