Class TagSupport

  • All Implemented Interfaces:
    java.io.Serializable, Tag
    Direct Known Subclasses:
    BodyTagSupport

    public class TagSupport
    extends java.lang.Object
    implements Tag, java.io.Serializable
    Actions in a Tag Library are defined through subclasses of Tag.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      TagSupport()
      Default constructor, all subclasses are required to only define a public constructor with the same signature, and to call the superclass constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int doEndTag()
      Process the end tag.
      int doStartTag()
      Process the start tag for this instance.
      static Tag findAncestorWithClass​(Tag from, java.lang.Class klass)
      Find the instance of a given class type that is closest to a given instance.
      java.lang.String getId()
      The value of the id attribute of this tag; or null.
      Tag getParent()
      The Tag instance enclosing this tag instance.
      java.lang.Object getValue​(java.lang.String k)
      Get a value
      java.util.Enumeration getValues()
      Enumerate the values
      void release()
      release() called after doEndTag() to reset state
      void removeValue​(java.lang.String k)
      Remove a value
      void setId​(java.lang.String id)
      Set the id attribute
      void setPageContext​(PageContext pageContext)
      set the page context
      void setParent​(Tag t)
      Set the nesting tag of this tag.
      void setValue​(java.lang.String k, java.lang.Object o)
      Set a value
      • 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
    • Constructor Detail

      • TagSupport

        public TagSupport()
        Default constructor, all subclasses are required to only define a public constructor with the same signature, and to call the superclass constructor. This constructor is called by the code generated by the JSP translator.
        Parameters:
        libraryPrefix - The namespace prefix used for this library. For example "jsp:".
        tagName - The name of the element or yag, for example "useBean"
    • Method Detail

      • findAncestorWithClass

        public 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 class is used for coordination among cooperating tags.
        Parameters:
        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
      • doStartTag

        public int doStartTag()
                       throws JspException
        Process the start tag for this instance. The doStartTag() method assumes that all setter methods have been invoked before. When this method is invoked, the body has not yet been invoked.
        Specified by:
        doStartTag in interface Tag
        Throws:
        JspException
        See Also:
        BodyTag
      • doEndTag

        public int doEndTag()
                     throws JspException
        Process the end tag. This method will be called on all Tag objects. All instance state associated with this instance must be reset.
        Specified by:
        doEndTag in interface Tag
        Throws:
        JspException
      • release

        public void release()
        release() called after doEndTag() to reset state
        Specified by:
        release in interface Tag
      • setParent

        public void setParent​(Tag t)
        Set the nesting tag of this tag.
        Specified by:
        setParent in interface Tag
      • getParent

        public Tag getParent()
        The Tag instance enclosing this tag instance.
        Specified by:
        getParent in interface Tag
        Returns:
        the parent tag instance or null
      • setId

        public void setId​(java.lang.String id)
        Set the id attribute
      • getId

        public java.lang.String getId()
        The value of the id attribute of this tag; or null.
        Returns:
        the value of the id attribute, or null
      • setPageContext

        public void setPageContext​(PageContext pageContext)
        set the page context
        Specified by:
        setPageContext in interface Tag
      • setValue

        public void setValue​(java.lang.String k,
                             java.lang.Object o)
        Set a value
      • getValue

        public java.lang.Object getValue​(java.lang.String k)
        Get a value
      • removeValue

        public void removeValue​(java.lang.String k)
        Remove a value
      • getValues

        public java.util.Enumeration getValues()
        Enumerate the values