Class ForEachSupport
- All Implemented Interfaces:
LoopTag,IterationTag,JspTag,Tag,TryCatchFinally,Serializable
- Direct Known Subclasses:
ForEachTag,ForEachTag
Support for tag handlers for <forEach>, the core iteration tag in JSTL 1.0. This class extends LoopTagSupport and provides ForEach-specific functionality. The rtexprvalue library and the expression-evaluating library each have handlers that extend this class.
Localized here is the logic for handling the veritable smorgasbord of types supported by <forEach>, including arrays, Collections, and others. To see how the actual iteration is controlled, review the jakarta.servlet.jsp.jstl.core.LoopTagSupport class instead.
- Author:
- Shawn Bayern
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceprotected class -
Field Summary
FieldsFields inherited from class jakarta.servlet.jsp.jstl.core.LoopTagSupport
begin, beginSpecified, deferredExpression, end, endSpecified, itemId, statusId, step, stepSpecifiedFields inherited from class jakarta.servlet.jsp.tagext.TagSupport
id, pageContextFields inherited from interface jakarta.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAINFields inherited from interface jakarta.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanhasNext()Returns information concerning the availability of more items over which to iterate.protected 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).protected ForEachSupport.ForEachIteratorprotected ForEachSupport.ForEachIteratortoForEachIterator(boolean[] a) protected ForEachSupport.ForEachIteratortoForEachIterator(byte[] a) protected ForEachSupport.ForEachIteratortoForEachIterator(char[] a) protected ForEachSupport.ForEachIteratortoForEachIterator(double[] a) protected ForEachSupport.ForEachIteratortoForEachIterator(float[] a) protected ForEachSupport.ForEachIteratortoForEachIterator(int[] a) protected ForEachSupport.ForEachIteratortoForEachIterator(long[] a) protected ForEachSupport.ForEachIteratortoForEachIterator(short[] a) protected ForEachSupport.ForEachIteratorprotected ForEachSupport.ForEachIteratortoForEachIterator(Object[] a) protected ForEachSupport.ForEachIteratorprotected ForEachSupport.ForEachIteratorprotected ForEachSupport.ForEachIteratorprotected ForEachSupport.ForEachIteratorprotected ForEachSupport.ForEachIteratorMethods inherited from class jakarta.servlet.jsp.jstl.core.LoopTagSupport
doAfterBody, doCatch, doFinally, doStartTag, getCurrent, getDelims, getLoopStatus, setVar, setVarStatus, validateBegin, validateEnd, validateStepMethods inherited from class jakarta.servlet.jsp.tagext.TagSupport
doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.jsp.tagext.Tag
doEndTag, getParent, setPageContext, setParent
-
Field Details
-
items
-
rawItems
-
-
Constructor Details
-
ForEachSupport
public ForEachSupport()
-
-
Method Details
-
hasNext
Description 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:
trueif there is at least one more item to iterate over,falseotherwise- Throws:
JspTagException- thrown on error- See Also:
-
next
Description 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:
JspTagException- for other, unexpected exceptions
-
prepare
Description 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:
JspTagException- thrown on error
-
release
public void release()Description copied from class:LoopTagSupportReleases any resources this LoopTagSupport may have (or inherit).- Specified by:
releasein interfaceTag- Overrides:
releasein classLoopTagSupport- See Also:
-
supportedTypeForEachIterator
protected ForEachSupport.ForEachIterator supportedTypeForEachIterator(Object o) throws JspTagException - Throws:
JspTagException
-
toForEachIterator
- Throws:
JspTagException
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-
toForEachIterator
-