javax.servlet.jsp.jstl.core
Class ConditionalTagSupport
java.lang.Object
|
+--javax.servlet.jsp.tagext.TagSupport
|
+--javax.servlet.jsp.jstl.core.ConditionalTagSupport
- All Implemented Interfaces:
- IterationTag, java.io.Serializable, Tag
- public abstract class ConditionalTagSupport
- extends TagSupport
ConditionalTagSupport is an abstract class that facilitates
implementation of conditional tags -- specifically, tags in the style
of <if>.
In particular, this base class provides support for:
- conditional execution based on an overridable condition()
method
- scoped attributes storing the result (as a Boolean) of the
logic executed by a subclass (optionally by attribute)
Since this method implements the behavior anticipated to be
recommended by the standard (with respect to tags that support
boolean logic), it is expected that it will be part of the JSTL API.
- See Also:
- Serialized Form
Method Summary |
protected abstract boolean |
condition()
Returns a boolean representing the condition that
a particular subclass uses to drive its conditional logic. |
int |
doStartTag()
Includes its body if condition() evalutes to true. |
void |
release()
Releases any resources this ConditionalTagSupport may have (or inherit). |
void |
setScope(java.lang.String scope)
Sets the 'scope' attribute. |
void |
setVar(java.lang.String var)
Sets the 'var' attribute. |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConditionalTagSupport
public ConditionalTagSupport()
- Base constructor to initialize local state. As with TagSupport,
subclasses should not provide other constructors and are expected
to call the superclass constructor.
condition
protected abstract boolean condition()
throws JspTagException
Returns a boolean representing the condition that
a particular subclass uses to drive its conditional logic.
- Returns:
- a boolean representing the result of arbitrary logic
that will be used to drive a tag's behavior
doStartTag
public int doStartTag()
throws JspException
- Includes its body if condition() evalutes to true.
- Overrides:
doStartTag
in class TagSupport
- Following copied from class:
javax.servlet.jsp.tagext.TagSupport
- See Also:
Tag.doStartTag()
release
public void release()
- Releases any resources this ConditionalTagSupport may have (or inherit).
- Overrides:
release
in class TagSupport
- Following copied from class:
javax.servlet.jsp.tagext.TagSupport
- See Also:
Tag.release()
setVar
public void setVar(java.lang.String var)
- Sets the 'var' attribute.
- Parameters:
var
- Name of the exported scoped variable storing the result of
condition().
setScope
public void setScope(java.lang.String scope)
- Sets the 'scope' attribute.
- Parameters:
scope
- Scope of the 'var' attribute