/** * Enables looping over a list of element values in the given parent container, same as * using the <code><cms:contentloop element="***" /></code> tag.<p> * * @param container the XML content container to read the content from * @param element the element to loop over * * @return an XML content container to be used to loop over the selected element values in the parent container */ public I_CmsXmlContentContainer contentloop(I_CmsXmlContentContainer container, String element) { return new CmsJspTagContentLoop(container, element); }
/** * Constructor used when using <code>contentloop</code> from scriptlet code.<p> * * @param container the parent content container that provides the content element to loop * @param element the element to loop in the content */ public CmsJspTagContentLoop(I_CmsXmlContentContainer container, String element) { m_element = element; init(container); }
/** * @see javax.servlet.jsp.tagext.Tag#doEndTag() */ @Override public int doEndTag() { release(); return EVAL_PAGE; }
/** * @see javax.servlet.jsp.tagext.Tag#doStartTag() */ @Override public int doStartTag() throws JspException { // get a reference to the parent "content container" class Tag ancestor = findAncestorWithClass(this, I_CmsXmlContentContainer.class); if (ancestor == null) { CmsMessageContainer errMsgContainer = Messages.get().container(Messages.ERR_PARENTLESS_TAG_1, "contentloop"); String msg = Messages.getLocalizedMessage(errMsgContainer, pageContext); throw new JspTagException(msg); } I_CmsXmlContentContainer container = (I_CmsXmlContentContainer)ancestor; // initialize the content init(container); if (hasMoreContent()) { // selected element is available at last once in content return EVAL_BODY_INCLUDE; } else { // no value available for the selected element name, so we skip the whole body return SKIP_BODY; } }
/** * @see javax.servlet.jsp.tagext.Tag#doStartTag() */ @Override public int doStartTag() throws JspException { // get a reference to the parent "content container" class Tag ancestor = findAncestorWithClass(this, I_CmsXmlContentContainer.class); if (ancestor == null) { CmsMessageContainer errMsgContainer = Messages.get().container( Messages.ERR_PARENTLESS_TAG_1, "contentloop"); String msg = Messages.getLocalizedMessage(errMsgContainer, pageContext); throw new JspTagException(msg); } I_CmsXmlContentContainer container = (I_CmsXmlContentContainer)ancestor; // initialize the content init(container); if (hasMoreResources()) { // selected element is available at last once in content return EVAL_BODY_INCLUDE; } else { // no value available for the selected element name, so we skip the whole body return SKIP_BODY; } }
/** * @see javax.servlet.jsp.tagext.TagSupport#doAfterBody() */ @Override public int doAfterBody() { if (hasMoreResources()) { // one more element with the same name is available, loop again return EVAL_BODY_AGAIN; } // no more elements with this name available, finish the loop return SKIP_BODY; }
/** * @see javax.servlet.jsp.tagext.TagSupport#doAfterBody() */ @Override public int doAfterBody() { if (hasMoreContent()) { // one more element with the same name is available, loop again return EVAL_BODY_AGAIN; } // no more elements with this name available, finish the loop return SKIP_BODY; }
/** * @see org.opencms.jsp.I_CmsResourceContainer#hasMoreContent() */ @Deprecated public boolean hasMoreContent() { return hasMoreResources(); }
/** * Enables looping over a list of element values in the given parent container, same as * using the <code><cms:contentloop element="***" /></code> tag.<p> * * @param container the XML content container to read the content from * @param element the element to loop over * * @return an XML content container to be used to loop over the selected element values in the parent container */ public I_CmsXmlContentContainer contentloop(I_CmsXmlContentContainer container, String element) { return new CmsJspTagContentLoop(container, element); }
/** * Constructor used when using <code>contentloop</code> from scriptlet code.<p> * * @param container the parent content container that provides the content element to loop * @param element the element to loop in the content */ public CmsJspTagContentLoop(I_CmsXmlContentContainer container, String element) { m_element = element; init(container); }
/** * @see javax.servlet.jsp.tagext.Tag#doEndTag() */ @Override public int doEndTag() { if (OpenCms.getSystemInfo().getServletContainerSettings().isReleaseTagsAfterEnd()) { // need to release manually, JSP container may not call release as required (happens with Tomcat) release(); } return EVAL_PAGE; }