首页 > IT职业 > IT图书 > 使用InitBinder来处理Date类型的参数
@RequestMapping("/date") public String date(Date date){
System.out.println(date);
return "hello";
}
@InitBinder
public void initBinder(ServletRequestDataBinder binder){ binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3368/viewspace-2798637/ ,如需转载,请注明出处,否则将追究法律责任。