Package javax.servlet.jsp.jstl.core
Class ConditionalTagSupport
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.jstl.core.ConditionalTagSupport
-
- All Implemented Interfaces:
java.io.Serializable,javax.servlet.jsp.tagext.IterationTag,javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.tagext.Tag
- Direct Known Subclasses:
IfTag,IfTag,IfTag,WhenTagSupport
public abstract class ConditionalTagSupport extends javax.servlet.jsp.tagext.TagSupportAbstract 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:
- Conditional processing of the action's body based on the returned value of the abstract method condition().
- Storing the result of condition() as a Boolean object into a JSP scoped variable identified by attributes var and scope.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConditionalTagSupport()Base constructor to initialize local state.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleancondition()Subclasses implement this method to compute the boolean result of the conditional action.intdoStartTag()Includes its body if condition() evaluates to true.private voidexposeVariables()private voidinit()voidrelease()Releases any resources this ConditionalTagSupport may have (or inherit).voidsetScope(java.lang.String scope)Sets the 'scope' attribute.voidsetVar(java.lang.String var)Sets the 'var' attribute.
-
-
-
Method Detail
-
condition
protected abstract boolean condition() throws javax.servlet.jsp.JspTagExceptionSubclasses implement this method to compute the boolean result of the conditional action. This method is invoked once per tag invocation by doStartTag().
- Returns:
- a boolean representing the condition that a particular subclass uses to drive its conditional logic.
- Throws:
javax.servlet.jsp.JspTagException
-
doStartTag
public int doStartTag() throws javax.servlet.jsp.JspExceptionIncludes its body if condition() evaluates to true.- Specified by:
doStartTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doStartTagin classjavax.servlet.jsp.tagext.TagSupport- Throws:
javax.servlet.jsp.JspException
-
release
public void release()
Releases any resources this ConditionalTagSupport may have (or inherit).- Specified by:
releasein interfacejavax.servlet.jsp.tagext.Tag- Overrides:
releasein classjavax.servlet.jsp.tagext.TagSupport
-
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
-
exposeVariables
private void exposeVariables()
-
init
private void init()
-
-