@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
dateFormat.setLenient(false);
// true passed to CustomDateEditor constructor means convert empty
// String to null
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
dateFormat.setLenient(false);
// true passed to CustomDateEditor constructor means convert empty
// String to null
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
这样就可以直接收集参数而不用处理