javax.servlet.jsp.jstl.core

Class ConditionalTagSupport

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:

Author: Shawn Bayern

Constructor Summary
ConditionalTagSupport()
Base constructor to initialize local state.
Method Summary
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.
voidrelease()
Releases any resources this ConditionalTagSupport may have (or inherit).
voidsetScope(String scope)
Sets the 'scope' attribute.
voidsetVar(String var)
Sets the 'var' attribute.

Constructor Detail

ConditionalTagSupport

public ConditionalTagSupport()
Base constructor to initialize local state. As with TagSupport, subclasses should not implement constructors with arguments, and no-argument constructors implemented by subclasses must call the superclass constructor.

Method Detail

condition

protected abstract boolean condition()

Subclasses 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.

doStartTag

public int doStartTag()
Includes its body if condition() evaluates to true.

release

public void release()
Releases any resources this ConditionalTagSupport may have (or inherit).

setScope

public void setScope(String scope)
Sets the 'scope' attribute.

Parameters: scope Scope of the 'var' attribute

setVar

public void setVar(String var)
Sets the 'var' attribute.

Parameters: var Name of the exported scoped variable storing the result of condition().

Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.