Class ForEachTag
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.jstl.core.LoopTagSupport
-
- org.apache.taglibs.standard.tag.common.xml.ForEachTag
-
- All Implemented Interfaces:
java.io.Serializable,LoopTag,javax.servlet.jsp.tagext.IterationTag,javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.tagext.Tag,javax.servlet.jsp.tagext.TryCatchFinally
public class ForEachTag extends LoopTagSupport
Implementation of <x:forEach> tag using low-level Xalan API.- See Also:
LoopTagSupport, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.xpath.XPathContextcontextprivate org.apache.xpath.XPathselect-
Fields inherited from class javax.servlet.jsp.jstl.core.LoopTagSupport
begin, beginSpecified, deferredExpression, end, endSpecified, itemId, statusId, step, stepSpecified
-
-
Constructor Summary
Constructors Constructor Description ForEachTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdoAfterBody()Continues the iteration when appropriate -- that is, if we (a) have more items and (b) don't run over our 'end' (given our 'step').voiddoFinally()Removes any attributes that this LoopTagSupport set.(package private) org.apache.xpath.XPathContextgetContext()Return the current XPath context to support expression evaluation in nested tags.protected booleanhasNext()Returns information concerning the availability of more items over which to iterate.protected java.lang.Objectnext()Returns the next object over which the tag should iterate.protected voidprepare()Prepares for a single tag invocation.voidrelease()Releases any resources this LoopTagSupport may have (or inherit).voidsetBegin(int begin)voidsetEnd(int end)voidsetSelect(java.lang.String select)voidsetStep(int step)-
Methods inherited from class javax.servlet.jsp.jstl.core.LoopTagSupport
doCatch, doStartTag, getCurrent, getDelims, getLoopStatus, setVar, setVarStatus, validateBegin, validateEnd, validateStep
-
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
-
-
-
-
Method Detail
-
release
public void release()
Description copied from class:LoopTagSupportReleases any resources this LoopTagSupport may have (or inherit).- Specified by:
releasein interfacejavax.servlet.jsp.tagext.Tag- Overrides:
releasein classLoopTagSupport
-
prepare
protected void prepare() throws javax.servlet.jsp.JspTagExceptionDescription copied from class:LoopTagSupportPrepares for a single tag invocation. Specifically, allows subclasses to prepare for calls to hasNext() and next(). Subclasses can assume that prepare() will be called once for each invocation of doStartTag() in the superclass.
- Specified by:
preparein classLoopTagSupport- Throws:
javax.servlet.jsp.JspTagException
-
hasNext
protected boolean hasNext() throws javax.servlet.jsp.JspTagExceptionDescription copied from class:LoopTagSupportReturns information concerning the availability of more items over which to iterate. This method must be provided by concrete subclasses of LoopTagSupport to assist the iterative logic provided by the supporting base class.
See next for more information about the purpose and expectations behind this tag.
- Specified by:
hasNextin classLoopTagSupport- Returns:
- true if there is at least one more item to iterate over, false otherwise
- Throws:
javax.servlet.jsp.JspTagException- See Also:
LoopTagSupport.next()
-
next
protected java.lang.Object next() throws javax.servlet.jsp.JspTagExceptionDescription copied from class:LoopTagSupportReturns the next object over which the tag should iterate. This method must be provided by concrete subclasses of LoopTagSupport to inform the base logic about what objects it should iterate over.
It is expected that this method will generally be backed by an Iterator, but this will not always be the case. In particular, if retrieving the next object raises the possibility of an exception being thrown, this method allows that exception to propagate back to the JSP container as a JspTagException; a standalone Iterator would not be able to do this. (This explains why LoopTagSupport does not simply call for an Iterator from its subtags.)
- Specified by:
nextin classLoopTagSupport- Returns:
- the java.lang.Object to use in the next round of iteration
- Throws:
javax.servlet.jsp.JspTagException- for other, unexpected exceptions
-
doAfterBody
public int doAfterBody() throws javax.servlet.jsp.JspExceptionDescription copied from class:LoopTagSupportContinues the iteration when appropriate -- that is, if we (a) have more items and (b) don't run over our 'end' (given our 'step').- Specified by:
doAfterBodyin interfacejavax.servlet.jsp.tagext.IterationTag- Overrides:
doAfterBodyin classLoopTagSupport- Throws:
javax.servlet.jsp.JspException
-
doFinally
public void doFinally()
Description copied from class:LoopTagSupportRemoves any attributes that this LoopTagSupport set.These attributes are intended to support scripting variables with NESTED scope, so we don't want to pollute attribute space by leaving them lying around.
- Specified by:
doFinallyin interfacejavax.servlet.jsp.tagext.TryCatchFinally- Overrides:
doFinallyin classLoopTagSupport
-
setSelect
public void setSelect(java.lang.String select)
-
setBegin
public void setBegin(int begin) throws javax.servlet.jsp.JspTagException- Throws:
javax.servlet.jsp.JspTagException
-
setEnd
public void setEnd(int end) throws javax.servlet.jsp.JspTagException- Throws:
javax.servlet.jsp.JspTagException
-
setStep
public void setStep(int step) throws javax.servlet.jsp.JspTagException- Throws:
javax.servlet.jsp.JspTagException
-
getContext
org.apache.xpath.XPathContext getContext()
Return the current XPath context to support expression evaluation in nested tags.- Returns:
- the current XPath context
-
-