728x90 반응형 error2 [Java] java.time.format.DateTimeParseException: Text 'yyyyMMdd' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {},ISO resolved to yyyy-MM-dd of type java.time.format.Parsed LocalDateTime.parse("20220720", DateTimeFormatter.ofPattern("yyyyMMdd")); java.time.format.DateTimeParseException: Text '20220720' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {},ISO resolved to 2022-07-20 of type java.time.format.Parsed 위 코드를 실행 시 DateTimeParseException 이 발생하는 이유는 자바가 Base Date 값을 DateTime으로 허용하지 않기때문입니다. LocalDateTime 대신 LocalDate를 사용하면 문제가 해결됩니다... 2022. 7. 20. [Spring] @ResponseBody, return null, MessageConverter Controller에서 String이 반환되면 view 이름을 찾아서 JSP를 렌더링 하고, view가 없으면 404를 반환합니다. @RequestMapping("main") public String main() { return "main"; } 만약 method에 @ResponseBody 어노테이션이 적용되어 있다면 view를 찾지 않고, String 값을 그대로 반환합니다. @ResponseBody @RequestMapping("readUserNm") public String readUserNm(UserVO param) throws Exception { return userService.readUserNm(param); } Dispatcher Servlet이 ModelAndView를 반환하면 Vi.. 2020. 10. 9. 이전 1 다음 728x90 반응형