且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ForEach循环中的JSP错误

更新时间:2022-10-15 18:43:45

Since cat is a collection of list, when you do ${cato.getCatogories_name}, expression language tries to manipulate getCatogories_name as a number(index in the list ie cato[]) hence it tries to parse getCatogories_name name as a number and you end up with NumberFormatException.

How about iterating over the list by using c:out?

<c:forEach items="${cato}" var="cat" varStatus="status">

<c:out value="${cato[status.index].catogories_name}" />

</c:forEach>