Class ConstantsTag

  • All Implemented Interfaces:
    Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

    public class ConstantsTag
    extends javax.servlet.jsp.tagext.TagSupport

    This class is designed to put all the public variables in a class to a specified scope - designed for exposing a Constants class to Tag Libraries.

    It is designed to be used as follows:
     <tag:constants />
     

    Optional values are "className" (fully qualified) and "scope".

    View Source
    Author:
    Matt Raible, originally., pavlidis modified
    See Also:
    Serialized Form
    • Field Detail

      • clazz

        public String clazz
        The class to expose the variables from.
      • scope

        protected String scope
        The scope to be put the variable in.
      • var

        protected String var
        The single variable to expose.
    • Constructor Detail

      • ConstantsTag

        public ConstantsTag()
    • Method Detail

      • doStartTag

        public int doStartTag()
                       throws javax.servlet.jsp.JspException
        Specified by:
        doStartTag in interface javax.servlet.jsp.tagext.Tag
        Overrides:
        doStartTag in class javax.servlet.jsp.tagext.TagSupport
        Throws:
        javax.servlet.jsp.JspException
      • getClassName

        public String getClassName()
      • setClassName

        public void setClassName​(String clazz)
      • getScope

        public String getScope()
      • setScope

        public void setScope​(String scope)
      • getScope

        public int getScope​(String scopeName)
                     throws javax.servlet.jsp.JspException
        Converts the scope name into its corresponding PageContext constant value.
        Parameters:
        scopeName - Can be "page", "request", "session", or "application" in any case.
        Returns:
        The constant representing the scope (ie. PageContext.REQUEST_SCOPE).
        Throws:
        javax.servlet.jsp.JspException - if the scopeName is not a valid name.
      • getVar

        public String getVar()
      • setVar

        public void setVar​(String var)
      • release

        public void release()
        Release all allocated resources.
        Specified by:
        release in interface javax.servlet.jsp.tagext.Tag
        Overrides:
        release in class javax.servlet.jsp.tagext.TagSupport