Class AbstractHtmlElementTag

All Implemented Interfaces:
jakarta.servlet.jsp.tagext.DynamicAttributes, jakarta.servlet.jsp.tagext.IterationTag, jakarta.servlet.jsp.tagext.JspTag, jakarta.servlet.jsp.tagext.Tag, jakarta.servlet.jsp.tagext.TryCatchFinally, Serializable, EditorAwareTag
Direct Known Subclasses:
AbstractHtmlElementBodyTag, AbstractHtmlInputElementTag, ButtonTag, FormTag, HiddenInputTag, LabelTag, OptionsTag

public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElementTag implements jakarta.servlet.jsp.tagext.DynamicAttributes
Base class for databinding-aware JSP tags that render HTML element. Provides a set of properties corresponding to the set of HTML attributes that are common across elements.

Additionally, this base class allows for rendering non-standard attributes as part of the tag's output. These attributes are accessible to subclasses if needed via the dynamicAttributes map.

Since:
2.0
Author:
Rob Harrop, Jeremy Grelle, Rossen Stoyanchev
See Also:
  • Field Details

  • Constructor Details

    • AbstractHtmlElementTag

      public AbstractHtmlElementTag()
  • Method Details

    • setCssClass

      public void setCssClass(String cssClass)
      Set the value of the 'class' attribute. May be a runtime expression.
    • getCssClass

      protected @Nullable String getCssClass()
      Get the value of the 'class' attribute. May be a runtime expression.
    • setCssErrorClass

      public void setCssErrorClass(String cssErrorClass)
      The CSS class to use when the field bound to a particular tag has errors. May be a runtime expression.
    • getCssErrorClass

      protected @Nullable String getCssErrorClass()
      The CSS class to use when the field bound to a particular tag has errors. May be a runtime expression.
    • setCssStyle

      public void setCssStyle(String cssStyle)
      Set the value of the 'style' attribute. May be a runtime expression.
    • getCssStyle

      protected @Nullable String getCssStyle()
      Get the value of the 'style' attribute. May be a runtime expression.
    • setLang

      public void setLang(String lang)
      Set the value of the 'lang' attribute. May be a runtime expression.
    • getLang

      protected @Nullable String getLang()
      Get the value of the 'lang' attribute. May be a runtime expression.
    • setTitle

      public void setTitle(String title)
      Set the value of the 'title' attribute. May be a runtime expression.
    • getTitle

      protected @Nullable String getTitle()
      Get the value of the 'title' attribute. May be a runtime expression.
    • setDir

      public void setDir(String dir)
      Set the value of the 'dir' attribute. May be a runtime expression.
    • getDir

      protected @Nullable String getDir()
      Get the value of the 'dir' attribute. May be a runtime expression.
    • setTabindex

      public void setTabindex(String tabindex)
      Set the value of the 'tabindex' attribute. May be a runtime expression.
    • getTabindex

      protected @Nullable String getTabindex()
      Get the value of the 'tabindex' attribute. May be a runtime expression.
    • setOnclick

      public void setOnclick(String onclick)
      Set the value of the 'onclick' attribute. May be a runtime expression.
    • getOnclick

      protected @Nullable String getOnclick()
      Get the value of the 'onclick' attribute. May be a runtime expression.
    • setOndblclick

      public void setOndblclick(String ondblclick)
      Set the value of the 'ondblclick' attribute. May be a runtime expression.
    • getOndblclick

      protected @Nullable String getOndblclick()
      Get the value of the 'ondblclick' attribute. May be a runtime expression.
    • setOnmousedown

      public void setOnmousedown(String onmousedown)
      Set the value of the 'onmousedown' attribute. May be a runtime expression.
    • getOnmousedown

      protected @Nullable String getOnmousedown()
      Get the value of the 'onmousedown' attribute. May be a runtime expression.
    • setOnmouseup

      public void setOnmouseup(String onmouseup)
      Set the value of the 'onmouseup' attribute. May be a runtime expression.
    • getOnmouseup

      protected @Nullable String getOnmouseup()
      Get the value of the 'onmouseup' attribute. May be a runtime expression.
    • setOnmouseover

      public void setOnmouseover(String onmouseover)
      Set the value of the 'onmouseover' attribute. May be a runtime expression.
    • getOnmouseover

      protected @Nullable String getOnmouseover()
      Get the value of the 'onmouseover' attribute. May be a runtime expression.
    • setOnmousemove

      public void setOnmousemove(String onmousemove)
      Set the value of the 'onmousemove' attribute. May be a runtime expression.
    • getOnmousemove

      protected @Nullable String getOnmousemove()
      Get the value of the 'onmousemove' attribute. May be a runtime expression.
    • setOnmouseout

      public void setOnmouseout(String onmouseout)
      Set the value of the 'onmouseout' attribute. May be a runtime expression.
    • getOnmouseout

      protected @Nullable String getOnmouseout()
      Get the value of the 'onmouseout' attribute. May be a runtime expression.
    • setOnkeypress

      public void setOnkeypress(String onkeypress)
      Set the value of the 'onkeypress' attribute. May be a runtime expression.
    • getOnkeypress

      protected @Nullable String getOnkeypress()
      Get the value of the 'onkeypress' attribute. May be a runtime expression.
    • setOnkeyup

      public void setOnkeyup(String onkeyup)
      Set the value of the 'onkeyup' attribute. May be a runtime expression.
    • getOnkeyup

      protected @Nullable String getOnkeyup()
      Get the value of the 'onkeyup' attribute. May be a runtime expression.
    • setOnkeydown

      public void setOnkeydown(String onkeydown)
      Set the value of the 'onkeydown' attribute. May be a runtime expression.
    • getOnkeydown

      protected @Nullable String getOnkeydown()
      Get the value of the 'onkeydown' attribute. May be a runtime expression.
    • getDynamicAttributes

      protected @Nullable Map<String,Object> getDynamicAttributes()
      Get the map of dynamic attributes.
    • setDynamicAttribute

      public void setDynamicAttribute(String uri, String localName, Object value) throws jakarta.servlet.jsp.JspException
      Specified by:
      setDynamicAttribute in interface jakarta.servlet.jsp.tagext.DynamicAttributes
      Throws:
      jakarta.servlet.jsp.JspException
    • isValidDynamicAttribute

      protected boolean isValidDynamicAttribute(String localName, Object value)
      Whether the given name-value pair is a valid dynamic attribute.
    • writeDefaultAttributes

      protected void writeDefaultAttributes(TagWriter tagWriter) throws jakarta.servlet.jsp.JspException
      Writes the default attributes configured via this base class to the supplied TagWriter. Subclasses should call this when they want the base attribute set to be written to the output.
      Overrides:
      writeDefaultAttributes in class AbstractDataBoundFormElementTag
      Parameters:
      tagWriter - the TagWriter to which any attributes are to be written
      Throws:
      jakarta.servlet.jsp.JspException
    • writeOptionalAttributes

      protected void writeOptionalAttributes(TagWriter tagWriter) throws jakarta.servlet.jsp.JspException
      Writes the optional attributes configured via this base class to the supplied TagWriter. The set of optional attributes that will be rendered includes any non-standard dynamic attributes. Called by writeDefaultAttributes(TagWriter).
      Throws:
      jakarta.servlet.jsp.JspException
    • resolveCssClass

      protected String resolveCssClass() throws jakarta.servlet.jsp.JspException
      Gets the appropriate CSS class to use based on the state of the current BindStatus object.
      Throws:
      jakarta.servlet.jsp.JspException