public abstract class ConditionalTagSupport
extends javax.servlet.jsp.tagext.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:
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(String scope)
Sets the 'scope' attribute.
|
void |
setVar(String var)
Sets the 'var' attribute.
|
public ConditionalTagSupport()
protected abstract boolean condition() throws javax.servlet.jsp.JspTagException
Subclasses implement this method to compute the boolean result of the conditional action. This method is invoked once per tag invocation by doStartTag().
javax.servlet.jsp.JspTagException
public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
public void release()
release
in interface javax.servlet.jsp.tagext.Tag
release
in class javax.servlet.jsp.tagext.TagSupport
public void setVar(String var)
var
- Name of the exported scoped variable storing the result of
condition().public void setScope(String scope)
scope
- Scope of the 'var' attributeCopyright © 2001-2014 The Apache Software Foundation. All Rights Reserved.