웹프로그래밍/오류 노트

java.lang.NumberFormatException: For input string:

Gamcho 2018. 8. 10. 11:09

개발환경: 스프링4 / myBatis


오류내용:

DB에서 가져온 데이터를 ModelAndView 객체에 담아서 jsp로 보냈는데 

forEach 문으로 출력되는 과정에서 java.lang.NumberFormatException 익셉션 발생


해결:

forEach문을 잘못 사용했다.

sellBestItem로 접근하지 않고 var 값으로 접근하니 해결됨


<c:forEach items="${sellBestItem}" var="sellBest" begin="0" varStatus="status" end="${fn:length(sellBestItem)}">


${sellBestItem.GOODS_NUMBER}   - > ${sellBest.GOODS_NUMBER}


</c:forEach>