「Spring MVC」InitBinderでDate型パラメータを設定するコード

Javaコード
//the parameter was converted in initBinder
@RequestMapping(“/date")
public String date(Date date){
System.out.println(date);
return “hello";
}

//At the time of initialization,convert the type “String" to type “date"
@InitBinder
public void initBinder(ServletRequestDataBinder binder){
binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat(“yyyy-MM-dd"),
true));
}

Java

Posted by arkgame