Class AbstractHtmlElementBodyTag

All Implemented Interfaces:
jakarta.servlet.jsp.tagext.BodyTag, 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:
ErrorsTag, OptionTag

public abstract class AbstractHtmlElementBodyTag extends AbstractHtmlElementTag implements jakarta.servlet.jsp.tagext.BodyTag
Convenient superclass for many html tags that render content using the databinding features of the AbstractHtmlElementTag. The only thing sub-tags need to do is override renderDefaultContent(TagWriter).
Since:
2.0
Author:
Rob Harrop, Juergen Hoeller
See Also:
  • Constructor Details

    • AbstractHtmlElementBodyTag

      public AbstractHtmlElementBodyTag()
  • Method Details

    • writeTagContent

      protected int writeTagContent(TagWriter tagWriter) throws jakarta.servlet.jsp.JspException
      Description copied from class: AbstractFormTag
      Subclasses should implement this method to perform tag content rendering.
      Specified by:
      writeTagContent in class AbstractFormTag
      Returns:
      valid tag render instruction as per Tag.doStartTag().
      Throws:
      jakarta.servlet.jsp.JspException
    • doEndTag

      public int doEndTag() throws jakarta.servlet.jsp.JspException
      If rendering, flush any buffered BodyContent or, if no BodyContent is supplied, render the default content.
      Specified by:
      doEndTag in interface jakarta.servlet.jsp.tagext.Tag
      Overrides:
      doEndTag in class jakarta.servlet.jsp.tagext.TagSupport
      Returns:
      a Tag.EVAL_PAGE result
      Throws:
      jakarta.servlet.jsp.JspException
    • renderFromBodyContent

      protected void renderFromBodyContent(jakarta.servlet.jsp.tagext.BodyContent bodyContent, TagWriter tagWriter) throws jakarta.servlet.jsp.JspException
      Render the tag contents based on the supplied BodyContent.

      The default implementation simply flushes the BodyContent directly to the output. Subclasses may choose to override this to add additional content to the output.

      Throws:
      jakarta.servlet.jsp.JspException
    • doFinally

      public void doFinally()
      Clean up any attributes and stored resources.
      Specified by:
      doFinally in interface jakarta.servlet.jsp.tagext.TryCatchFinally
      Overrides:
      doFinally in class AbstractDataBoundFormElementTag
    • onWriteTagContent

      protected void onWriteTagContent()
      Called at the start of writeTagContent(TagWriter) allowing subclasses to perform any precondition checks or setup tasks that might be necessary.
    • shouldRender

      protected boolean shouldRender() throws jakarta.servlet.jsp.JspException
      Should rendering of this tag proceed at all. Returns 'true' by default causing rendering to occur always, Subclasses can override this if they provide conditional rendering.
      Throws:
      jakarta.servlet.jsp.JspException
    • exposeAttributes

      protected void exposeAttributes() throws jakarta.servlet.jsp.JspException
      Called during writeTagContent(TagWriter) allowing subclasses to add any attributes to the PageContext as needed.
      Throws:
      jakarta.servlet.jsp.JspException
    • removeAttributes

      protected void removeAttributes()
      Called by doFinally() allowing subclasses to remove any attributes from the PageContext as needed.
    • flushBufferedBodyContent

      protected void flushBufferedBodyContent(jakarta.servlet.jsp.tagext.BodyContent bodyContent) throws jakarta.servlet.jsp.JspException
      The user customised the output of the error messages - flush the buffered content into the main JspWriter.
      Throws:
      jakarta.servlet.jsp.JspException
    • renderDefaultContent

      protected abstract void renderDefaultContent(TagWriter tagWriter) throws jakarta.servlet.jsp.JspException
      Throws:
      jakarta.servlet.jsp.JspException
    • doInitBody

      public void doInitBody() throws jakarta.servlet.jsp.JspException
      Specified by:
      doInitBody in interface jakarta.servlet.jsp.tagext.BodyTag
      Throws:
      jakarta.servlet.jsp.JspException
    • setBodyContent

      public void setBodyContent(jakarta.servlet.jsp.tagext.BodyContent bodyContent)
      Specified by:
      setBodyContent in interface jakarta.servlet.jsp.tagext.BodyTag