Hi,

I use the 'forEach' tag in my jsp page.

I assigned the 'items' attribute an Object of type HashSet to be the collection to iterate through.

How do i access the previous object in the iteration?

This is my code - in bold is the problem (currently its written as if the collection is a String array but obviously it should be in a different way for HashSet)


<c:forEach items="${UserObj.user.role}" var="role" varStatus="roleSts">
<c:if test="${roleSts.index == 0 || role.groupTitle != UserObj.user.role[roleSts.index-1].groupTitle }">
<tr><td>${role.groupTitle}</td></tr>
</c:if>
</c:forEach>



(${UserObj.user.role} returns a HashSet & this code crashes with JasperException)

Can i use the varStatus somehow? Maybe to define an Iterator?

Thanks.