javax.servlet.jsp.tagext
Class TagSupport

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
All Implemented Interfaces:
java.io.Serializable, Tag
Direct Known Subclasses:
BodyTagSupport

public class TagSupport
extends java.lang.Object
implements Tag, java.io.Serializable

Convenient support class for creating tags which don't analyze their bodies. Normally, tags will extend TagSupport instead of implementing Tag directly.

See Also:
Serialized Form

Field Summary
protected  java.lang.String id
           
protected  PageContext pageContext
           
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
TagSupport()
          Tags need to implement a zero-arg constructor.
 
Method Summary
 int doEndTag()
          Processed at the end of the tag.
 int doStartTag()
          Processed at the beginning of the tag.
static Tag findAncestorWithClass(Tag tag, java.lang.Class cl)
          Finds an ancestor of a tag matching the class.
 java.lang.String getId()
          Sets the id attribute.
 Tag getParent()
          Returns the tag's parent.
 java.lang.Object getValue(java.lang.String name)
          Returns an attribute from the tag.
 java.util.Enumeration getValues()
          Enumerates the tag's attributes.
 void release()
          Cleans the tag after it completes.
 void removeValue(java.lang.String name)
          Removes a value from the tag.
 void setId(java.lang.String id)
          Sets the id attribute.
 void setPageContext(PageContext page)
          Stores the page context for the JSP page.
 void setParent(Tag t)
          If the tag is contained in another tag, this sets the parent.
 void setValue(java.lang.String name, java.lang.Object value)
          Sets the value from a tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected java.lang.String id

pageContext

protected PageContext pageContext
Constructor Detail

TagSupport

public TagSupport()
Tags need to implement a zero-arg constructor.
Method Detail

doStartTag

public int doStartTag()
               throws JspException
Processed at the beginning of the tag. The default behavior is to skip the tag's body.
Specified by:
doStartTag in interface Tag
Following copied from interface: javax.servlet.jsp.tagext.Tag
Returns:
SKIP_BODY to ignore the body and EVAL_BODY_INCLUDE to evaluate the body.

doEndTag

public int doEndTag()
             throws JspException
Processed at the end of the tag. The default behavior continues with the rest of the JSP.
Specified by:
doEndTag in interface Tag
Following copied from interface: javax.servlet.jsp.tagext.Tag
Returns:
SKIP_PAGE to skip the rest of the page and EVAL_PAGE to continue with the rest of the page.

setId

public void setId(java.lang.String id)
Sets the id attribute.

getId

public java.lang.String getId()
Sets the id attribute.

setPageContext

public void setPageContext(PageContext page)
Stores the page context for the JSP page.
Specified by:
setPageContext in interface Tag

setParent

public void setParent(Tag t)
If the tag is contained in another tag, this sets the parent.
Specified by:
setParent in interface Tag

getParent

public Tag getParent()
Returns the tag's parent.
Specified by:
getParent in interface Tag

findAncestorWithClass

public static final Tag findAncestorWithClass(Tag tag,
                                              java.lang.Class cl)
Finds an ancestor of a tag matching the class.
Parameters:
tag - child tag to start searching.
cl - the class that the tag should implement.

getValue

public java.lang.Object getValue(java.lang.String name)
Returns an attribute from the tag.

getValues

public java.util.Enumeration getValues()
Enumerates the tag's attributes.

removeValue

public void removeValue(java.lang.String name)
Removes a value from the tag.

setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
Sets the value from a tag.

release

public void release()
Cleans the tag after it completes.
Specified by:
release in interface Tag