middlemoon
java.lang.NumberFormatException: For input string: "undefined" Error:500 본문
Develop/Springboot
java.lang.NumberFormatException: For input string: "undefined" Error:500
중대경 2022. 9. 30. 13:27
콘솔 에러 부분은 다음과 같다.
For input string: "undefined" 숫자로 변환할수 없는 스트링이 들어왔겠죠 예를들면 ""같은 문자같은 것이 왔을때 나오는 에러이다.
우선 에러난곳을 찾아보았다.

에러난곳은 int commentSeqInt = Integer.parseInt(commentSeq);
commentSeq라는 변수를 int로 나올수 있게끔 하나의 변수를 만들어준곳이였다. 이게 왜 에러인지보았더니,
commentSeq를 주관하는 부분은 comment_seq라는 DTO에 있는 객체이다 아래와 같다


ajax로 호출하는것이기때문에 리스트를 주관하는곳에 가서 item.comment


일치시켜줘야한다. ajax에서 controller를 호출한다면 거의 다 ajax 오류의 문법이 있으니 그쪽먼저 꼼꼼하게 확인하길 바란다!
생각보다 오류는 어렵지않은곳에 있지만 그것을 찾아낼수 있냐 없냐가 관건인것 같다 !!

'Develop > Springboot' 카테고리의 다른 글
| java.sql.SQLIntegrityConstraintViolationException: Column 'reportcontents' cannot be null (1) | 2022.10.18 |
|---|---|
| Springboot4 설정부터 DB연동까지 (0) | 2022.09.12 |
| +SpringMVC + Batis (Model + View + Controller) (0) | 2022.08.22 |
| Spring + Mybatis 연동예제1 (0) | 2022.08.22 |
| error404 :Tomcaterror/JSP is not found, not available (0) | 2022.08.21 |
Comments