javax.servlet.jsp.tagext
public class TagSupport extends Object implements IterationTag, Serializable
The TagSupport class is a utility class intended to be used as the base class for new tag handlers. The TagSupport class implements the Tag and IterationTag interfaces and adds additional convenience methods including getter methods for the properties in Tag. TagSupport has one static method that is included to facilitate coordination among cooperating tags.
Many tag handlers will extend TagSupport and only redefine a few methods.
Field Summary | |
---|---|
protected String | id
The value of the id attribute of this tag; or null. |
protected PageContext | pageContext
The PageContext. |
Constructor Summary | |
---|---|
TagSupport()
Default constructor, all subclasses are required to define only
a public constructor with the same signature, and to call the
superclass constructor.
|
Method Summary | |
---|---|
int | doAfterBody()
Default processing for a body.
|
int | doEndTag()
Default processing of the end tag returning EVAL_PAGE.
|
int | doStartTag()
Default processing of the start tag, returning SKIP_BODY.
|
static Tag | findAncestorWithClass(Tag from, Class klass)
Find the instance of a given class type that is closest to a given
instance.
|
String | getId()
The value of the id attribute of this tag; or null.
|
Tag | getParent()
The Tag instance most closely enclosing this tag instance. |
Object | getValue(String k)
Get a the value associated with a key.
|
Enumeration | getValues()
Enumerate the keys for the values kept by this tag handler.
|
void | release()
Release state.
|
void | removeValue(String k)
Remove a value associated with a key.
|
void | setId(String id)
Set the id attribute for this tag.
|
void | setPageContext(PageContext pageContext)
Set the page context.
|
void | setParent(Tag t)
Set the nesting tag of this tag.
|
void | setValue(String k, Object o)
Associate a value with a String key.
|
Returns: SKIP_BODY
Throws: JspException if an error occurs while processing this tag
See Also: doAfterBody
Returns: EVAL_PAGE
Throws: JspException if an error occurs while processing this tag
See Also: doEndTag
Returns: SKIP_BODY
Throws: JspException if an error occurs while processing this tag
See Also: doStartTag
The current version of the specification only provides one formal way of indicating the observable type of a tag handler: its tag handler implementation class, described in the tag-class subelement of the tag element. This is extended in an informal manner by allowing the tag library author to indicate in the description subelement an observable type. The type should be a subtype of the tag handler implementation class or void. This addititional constraint can be exploited by a specialized container that knows about that specific tag library, as in the case of the JSP standard tag library.
When a tag library author provides information on the observable type of a tag handler, client programmatic code should adhere to that constraint. Specifically, the Class passed to findAncestorWithClass should be a subtype of the observable type.
Parameters: from The instance from where to start looking. klass The subclass of Tag or interface to be matched
Returns: the nearest ancestor that implements the interface or is an instance of the class specified
Returns: the value of the id attribute, or null
Returns: the parent tag instance or null
Parameters: k The string key.
Returns: The value associated with the key, or null.
Returns: An enumeration of all the keys for the values set, or null or an empty Enumeration if no values have been set.
See Also: release
Parameters: k The string key.
Parameters: id The String for the id.
Parameters: pageContext The PageContext.
See Also: Tag
Parameters: t The parent Tag.
See Also: setParent
Parameters: k The key String. o The value to associate.