Class AbstractHtmlElementTag

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

public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElementTag implements 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

      @Nullable protected 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

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

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

      public void setDynamicAttribute(String uri, String localName, Object value) throws JspException
      Specified by:
      setDynamicAttribute in interface DynamicAttributes
      Throws:
      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 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:
      JspException
    • writeOptionalAttributes

      protected void writeOptionalAttributes(TagWriter tagWriter) throws 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:
      JspException
    • resolveCssClass

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