public abstract class ConditionalTagSupport extends TagSupport
Abstract class that facilitates implementation of conditional actions where the boolean result is exposed as a JSP scoped variable. The boolean result may then be used as the test condition in a <c:when> action.
This base class provides support for:
id, pageContext
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
ConditionalTagSupport()
Base constructor to initialize local state.
|
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
condition()
Subclasses implement this method to compute the boolean result
of the conditional action.
|
int |
doStartTag()
Includes its body if condition() evaluates 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.
|
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
public ConditionalTagSupport()
protected abstract boolean condition() throws JspTagException
Subclasses implement this method to compute the boolean result of the conditional action. This method is invoked once per tag invocation by doStartTag().
JspTagException
public int doStartTag() throws JspException
doStartTag
in interface Tag
doStartTag
in class TagSupport
JspException
- if an error occurs while processing this tagTag.doStartTag()
public void release()
release
in interface Tag
release
in class TagSupport
Tag.release()
public void setVar(java.lang.String var)
var
- Name of the exported scoped variable storing the result of
condition().public void setScope(java.lang.String scope)
scope
- Scope of the 'var' attribute