@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
binder.registerCustomEditor(Date.class, "param", new CustomDateEditor(dateFormat, true));
}
或者方法中参数添加:
@RequestParam(value = "param", required = false) String param