How to process the last item in findResources
I am trying to process the LAST item in a findResources query differently from all others, but I can't fugure out how to do that. Here is a code snippet that I'm trying out (findResources returns THREE 'telephone' objects in my JCR) :-
<sling:findResources query="/jcr:root ${currentPage.path} //*[${tagCriteria} @sling:resourceType = 'avivapocs/components/telephone']" language="xpath" var="resources" /> <c:forEach var="telephoneResource" items="${resources}"> <c:choose> <c:when test="${resources}.hasNext()"> DO SOMETHING WITH ALL OTHER telephone resource ITEMS </c:when> <c:otherwise> DO SOMETHING DIFFERENT WITH THE LAST telephone resource ITEM </c:otherwise> </c:choose> </c:forEach>But the 'otherwise' path is chosen in ALL cases.
Anyway, I am a bit stumped .. so any advice would be welcome.
Regards
Fraser.