2017-09-26 6 views

답변

0

initBinder과 같이 이러한 문제를 해결하기 위해 Spring MVC에 몇 가지 접근 방식이 있습니다. Validator가 (검증시) 오류를 던질 수 있도록이 Date 값을 initBinder에 먼저 전달하십시오. 이 시도

@InitBinder 
public void initBinder(WebDataBinder binder) { 
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); 
    binder.registerCustomEditor(Date.class, new 
             CustomDateEditor(dateFormat,true)); 
} 
+0

도움이 될 수 있습니다 그리고 당신은 아마 있도록'(false)를 dateFormat.setLenient는'당신의 바인더, 월 등의 값이 = 40 * * 허용되지 않습니다 싶습니다. – dbreaux

+0

스프링 웹 플로우와 동일한 작업을 수행합니까? –