public int doStartTag() { index += begin; Collection children; try { children = getCollection(); } catch (PathNotFoundException e) { // ok, this is normal return SKIP_BODY; } catch (AccessDeniedException e) { log.debug(e.getMessage()); return SKIP_BODY; } catch (RepositoryException e) { log.error(e.getMessage(), e); return SKIP_BODY; } this.size = children.size(); this.savePrevState(); pageContext.setAttribute(ContentNodeIterator.SIZE, new Integer(size), PageContext.REQUEST_SCOPE); pageContext.setAttribute(ContentNodeIterator.CURRENT_INDEX, new Integer(this.count), PageContext.REQUEST_SCOPE); pageContext.setAttribute(ContentNodeIterator.CONTENT_NODE_COLLECTION_NAME, getContentNodeCollectionName(), PageContext.REQUEST_SCOPE); Resource.setLocalContentNodeCollectionName(getContentNodeCollectionName()); // // // handle first node different // // pageContext.setAttribute( ContentNodeIterator.CURRENT_INDEX, new Integer(this.count), PageContext.REQUEST_SCOPE); if (StringUtils.isNotEmpty(varStatus)) { pageContext.setAttribute(varStatus, getLoopStatus()); } this.contentNodeIterator = children.iterator(); for (int i = 0; i <= begin; i++) { if (this.contentNodeIterator.hasNext()) { current = this.contentNodeIterator.next(); } } Resource.setLocalContentNode((Content) current); this.count++; // // // this could be improved ??? // // if (begin > this.size) { return SKIP_BODY; } else { return true ? EVAL_BODY_INCLUDE : SKIP_BODY; } } public int doAfterBody() { return doIteration() ? EVAL_BODY_AGAIN : SKIP_BODY; } private boolean doIteration() { if (this.end != null && this.count > this.end.intValue()) { return false; } pageContext.setAttribute( ContentNodeIterator.CURRENT_INDEX, new Integer(this.count), PageContext.REQUEST_SCOPE); if (StringUtils.isNotEmpty(varStatus)) { pageContext.setAttribute(varStatus, getLoopStatus()); } // // // moved hasNext() into the loop - that seems to work // // for (int j = 0; j < this.step; j++) { if (this.contentNodeIterator.hasNext()) { current = this.contentNodeIterator.next(); Resource.setLocalContentNode((Content) current); } else { return false; } } this.count++; return true; }