public abstract class LoopTagSupport extends TagSupport implements LoopTag, IterationTag, TryCatchFinally
Base support class to facilitate implementation of iteration tags.
Since most iteration tags will behave identically with respect to actual iterative behavior, JSTL provides this base support class to facilitate implementation. Many iteration tags will extend this and merely implement the hasNext() and next() methods to provide contents for the handler to iterate over.
In particular, this base class provides support for:
In providing support for these tasks, LoopTagSupport contains certain control variables that act to modify the iteration. Accessors are provided for these control variables when the variables represent information needed or wanted at translation time (e.g., var, varStatus). For other variables, accessors cannot be provided here since subclasses may differ on their implementations of how those accessors are received. For instance, one subclass might accept a String and convert it into an object of a specific type by using an expression evaluator; others might accept objects directly. Still others might not want to expose such information to outside control.
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
LoopTagSupport()
Constructs a new LoopTagSupport.
|
Modifier and Type | Method and Description |
---|---|
int |
doAfterBody()
Continues the iteration when appropriate -- that is, if we (a) have
more items and (b) don't run over our 'end' (given our 'step').
|
void |
doCatch(Throwable t)
Rethrows the given Throwable.
|
void |
doFinally()
Removes any attributes that this LoopTagSupport set.
|
int |
doStartTag()
Begins iterating by processing the first item.
|
Object |
getCurrent()
Retrieves the current item in the iteration.
|
LoopTagStatus |
getLoopStatus()
Retrieves a 'status' object to provide information about the
current round of the iteration.
|
void |
release()
Releases any resources this LoopTagSupport may have (or inherit).
|
void |
setVar(String id)
Sets the 'var' attribute.
|
void |
setVarStatus(String statusId)
Sets the 'varStatus' attribute.
|
doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doEndTag, getParent, setPageContext, setParent
public LoopTagSupport()
public void release()
release
in interface Tag
release
in class TagSupport
Tag.release()
public int doStartTag() throws JspException
doStartTag
in interface Tag
doStartTag
in class TagSupport
JspException
- if an error occurs while processing this tagTag.doStartTag()
public int doAfterBody() throws JspException
doAfterBody
in interface IterationTag
doAfterBody
in class TagSupport
JspException
- if an error occurs while processing this tagIterationTag.doAfterBody()
public void doFinally()
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.
doFinally
in interface TryCatchFinally
public void doCatch(Throwable t) throws Throwable
doCatch
in interface TryCatchFinally
t
- The throwable exception navigating through this tag.Throwable
- if the exception is to be rethrown further up
the nest chain.public Object getCurrent()
LoopTag
getCurrent
in interface LoopTag
public LoopTagStatus getLoopStatus()
LoopTag
getLoopStatus
in interface LoopTag
public void setVar(String id)
id
- Name of the exported scoped variable storing the current item
of the iteration.public void setVarStatus(String statusId)
statusId
- Name of the exported scoped variable storing the status
of the iteration.Copyright © 2010 - 2020 Adobe. All Rights Reserved