try {
if(description != null && title != null && boardTypeSeq != null &&
!(description.isEmpty() && title.isEmpty() && boardTypeSeq.isEmpty())) {
service.getInsert(params);
}
} catch (NullPointerException e) {
System.out.println("글작성에러");
}
return mv;
}
기존 코드에서는 Insert 이후 아무런 조치가 없음
>>> 이전에 전송된 폼 데이터가 계속 남아있기 때문에 에러 발생
try {
if(description != null && title != null && boardTypeSeq != null &&
!(description.isEmpty() && title.isEmpty() && boardTypeSeq.isEmpty())) {
service.getInsert(params);
return new ModelAndView("redirect:/forum/notice/listPage.do");
}
} catch (NullPointerException e) {
System.out.println("글작성에러");
}
return mv;
}
개선된 코드에서는 리다이렉트를 해줌으로써 이전에 전송된 데이터가 남아있지 않
| DateFormat 작성 시 주의할 점 (1) | 2024.05.14 |
|---|---|
| NumberFormatException이 왜 발생했는가? (0) | 2024.05.13 |
| EmptyResultDataAccessException 처리 (1) | 2024.05.13 |
| Dao새로 만들었을때 주의할점 (0) | 2024.05.11 |
| 로그에서 발생한 "/10/forum/notice/thumb-up.do" 경로에 대한 404 오류 (0) | 2024.05.10 |