public abstract class ForEachSupport extends LoopTagSupport
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 javax.servlet.jsp.jstl.core.LoopTagSupport class instead.
LoopTagSupport
,
Serialized FormModifier and Type | Class and Description |
---|---|
protected static interface |
ForEachSupport.ForEachIterator |
protected class |
ForEachSupport.SimpleForEachIterator |
Modifier and Type | Field and Description |
---|---|
protected ForEachSupport.ForEachIterator |
items |
protected Object |
rawItems |
begin, beginSpecified, deferredExpression, end, endSpecified, itemId, statusId, step, stepSpecified
id, pageContext
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
ForEachSupport() |
doAfterBody, doCatch, doFinally, doStartTag, getCurrent, getDelims, getLoopStatus, setVar, setVarStatus, validateBegin, validateEnd, validateStep
doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doEndTag, getParent, setPageContext, setParent
protected ForEachSupport.ForEachIterator items
protected Object rawItems
protected boolean hasNext() throws JspTagException
LoopTagSupport
Returns 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.
hasNext
in class LoopTagSupport
JspTagException
LoopTagSupport.next()
protected Object next() throws JspTagException
LoopTagSupport
Returns 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.)
next
in class LoopTagSupport
JspTagException
- for other, unexpected exceptionsprotected void prepare() throws JspTagException
LoopTagSupport
Prepares 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.
prepare
in class LoopTagSupport
JspTagException
public void release()
LoopTagSupport
release
in interface Tag
release
in class LoopTagSupport
Tag.release()
protected ForEachSupport.ForEachIterator supportedTypeForEachIterator(Object o) throws JspTagException
JspTagException
protected ForEachSupport.ForEachIterator toForEachIterator(Object o) throws JspTagException
JspTagException
protected ForEachSupport.ForEachIterator toForEachIterator(Object[] a)
protected ForEachSupport.ForEachIterator toForEachIterator(boolean[] a)
protected ForEachSupport.ForEachIterator toForEachIterator(byte[] a)
protected ForEachSupport.ForEachIterator toForEachIterator(char[] a)
protected ForEachSupport.ForEachIterator toForEachIterator(short[] a)
protected ForEachSupport.ForEachIterator toForEachIterator(int[] a)
protected ForEachSupport.ForEachIterator toForEachIterator(long[] a)
protected ForEachSupport.ForEachIterator toForEachIterator(float[] a)
protected ForEachSupport.ForEachIterator toForEachIterator(double[] a)
protected ForEachSupport.ForEachIterator toForEachIterator(Collection c)
protected ForEachSupport.ForEachIterator toForEachIterator(Iterator i)
protected ForEachSupport.ForEachIterator toForEachIterator(Enumeration e)
protected ForEachSupport.ForEachIterator toForEachIterator(Map m)
protected ForEachSupport.ForEachIterator toForEachIterator(String s)
Copyright © 2018 JBoss by Red Hat. All rights reserved.