Class TagSupport
- java.lang.Object
- 
- javax.servlet.jsp.tagext.TagSupport
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- IterationTag,- JspTag,- Tag
 - Direct Known Subclasses:
- BodyTagSupport
 
 public class TagSupport extends java.lang.Object implements IterationTag, java.io.Serializable A base class for defining new tag handlers implementing Tag.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. - See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.StringidThe value of the id attribute of this tag; or null.protected PageContextpageContextThe PageContext.- 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTagEVAL_BODY_AGAIN
 - 
Fields inherited from interface javax.servlet.jsp.tagext.TagEVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
- 
 - 
Constructor SummaryConstructors Constructor Description TagSupport()Default constructor, all subclasses are required to define only a public constructor with the same signature, and to call the superclass constructor.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intdoAfterBody()Default processing for a body.intdoEndTag()Default processing of the end tag returning EVAL_PAGE.intdoStartTag()Default processing of the start tag, returning SKIP_BODY.static TagfindAncestorWithClass(Tag from, java.lang.Class klass)Find the instance of a given class type that is closest to a given instance.java.lang.StringgetId()The value of the id attribute of this tag; or null.TaggetParent()The Tag instance most closely enclosing this tag instance.java.lang.ObjectgetValue(java.lang.String k)Get a the value associated with a key.java.util.Enumeration<java.lang.String>getValues()Enumerate the keys for the values kept by this tag handler.voidrelease()Release state.voidremoveValue(java.lang.String k)Remove a value associated with a key.voidsetId(java.lang.String id)Set the id attribute for this tag.voidsetPageContext(PageContext pageContext)Set the page context.voidsetParent(Tag t)Set the nesting tag of this tag.voidsetValue(java.lang.String k, java.lang.Object o)Associate a value with a String key.
 
- 
- 
- 
Field Detail- 
idprotected java.lang.String id The value of the id attribute of this tag; or null.
 - 
pageContextprotected transient PageContext pageContext The PageContext.
 
- 
 - 
Method Detail- 
findAncestorWithClasspublic static final Tag findAncestorWithClass(Tag from, java.lang.Class klass) Find the instance of a given class type that is closest to a given instance. This method uses the getParent method from the Tag interface. This method is used for coordination among cooperating tags.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 additional 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
 
 - 
doStartTagpublic int doStartTag() throws JspExceptionDefault processing of the start tag, returning SKIP_BODY.- Specified by:
- doStartTagin interface- Tag
- Returns:
- SKIP_BODY
- Throws:
- JspException- if an error occurs while processing this tag
- See Also:
- Tag.doStartTag()
 
 - 
doEndTagpublic int doEndTag() throws JspExceptionDefault processing of the end tag returning EVAL_PAGE.- Specified by:
- doEndTagin interface- Tag
- Returns:
- EVAL_PAGE
- Throws:
- JspException- if an error occurs while processing this tag
- See Also:
- Tag.doEndTag()
 
 - 
doAfterBodypublic int doAfterBody() throws JspExceptionDefault processing for a body.- Specified by:
- doAfterBodyin interface- IterationTag
- Returns:
- SKIP_BODY
- Throws:
- JspException- if an error occurs while processing this tag
- See Also:
- IterationTag.doAfterBody()
 
 - 
releasepublic void release() Release state.- Specified by:
- releasein interface- Tag
- See Also:
- Tag.release()
 
 - 
setParentpublic void setParent(Tag t) Set the nesting tag of this tag.- Specified by:
- setParentin interface- Tag
- Parameters:
- t- The parent Tag.
- See Also:
- Tag.setParent(Tag)
 
 - 
getParentpublic Tag getParent() The Tag instance most closely enclosing this tag instance.- Specified by:
- getParentin interface- Tag
- Returns:
- the parent tag instance or null
- See Also:
- Tag.getParent()
 
 - 
setIdpublic void setId(java.lang.String id) Set the id attribute for this tag.- Parameters:
- id- The String for the id.
 
 - 
getIdpublic java.lang.String getId() The value of the id attribute of this tag; or null.- Returns:
- the value of the id attribute, or null
 
 - 
setPageContextpublic void setPageContext(PageContext pageContext) Set the page context.- Specified by:
- setPageContextin interface- Tag
- Parameters:
- pageContext- The PageContext.
- See Also:
- Tag.setPageContext(javax.servlet.jsp.PageContext)
 
 - 
setValuepublic void setValue(java.lang.String k, java.lang.Object o)Associate a value with a String key.- Parameters:
- k- The key String.
- o- The value to associate.
 
 - 
getValuepublic java.lang.Object getValue(java.lang.String k) Get a the value associated with a key.- Parameters:
- k- The string key.
- Returns:
- The value associated with the key, or null.
 
 - 
removeValuepublic void removeValue(java.lang.String k) Remove a value associated with a key.- Parameters:
- k- The string key.
 
 - 
getValuespublic java.util.Enumeration<java.lang.String> getValues() Enumerate the keys for the values kept by this tag handler.- Returns:
- An enumeration of all the keys for the values set, or null or an empty Enumeration if no values have been set.
 
 
- 
 
-