public abstract class ConditionalTagSupport
extends jakarta.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 jakarta.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().
jakarta.servlet.jsp.JspTagExceptionpublic int doStartTag()
throws jakarta.servlet.jsp.JspException
doStartTag in interface jakarta.servlet.jsp.tagext.TagdoStartTag in class jakarta.servlet.jsp.tagext.TagSupportjakarta.servlet.jsp.JspExceptionpublic void release()
release in interface jakarta.servlet.jsp.tagext.Tagrelease in class jakarta.servlet.jsp.tagext.TagSupportpublic 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' attributeComments to: jstl-dev@eclipse.org.
Copyright © 2019, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.