Spring MVC Controller에서 Date를 parameter으로 받는 방법


Spring MVC Controller에서 Date를 parameter으로 받는 방법

아래와 같이 @RequestParam을 사용하여 Date를 parameter로 받으려고 시도 할 경우 400 오류가 발생합니다. @RequestMapping(value="/fetch" , method=RequestMethod.GET) public @ResponseBody String fetchResult(@RequestParam("from") Date fromDate) { //Content goes here } HTTP Status 400: The request sent by the client was syntactically incorrect. 오류 메시지 이 경우 @DateTimeFormat Annotation을 사용하면 해결됩니다. @RequestMapping(value="/fetch" , method=RequestMethod.GET) public @ResponseBody String fetchResult(@RequestParam("from") @DateTimeFormat(pa...



원문링크 : Spring MVC Controller에서 Date를 parameter으로 받는 방법