Spring Framework

org.springframework.web.servlet.tags.form
Class AbstractHtmlElementBodyTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.springframework.web.servlet.tags.RequestContextAwareTag
          extended by org.springframework.web.servlet.tags.HtmlEscapingAwareTag
              extended by org.springframework.web.servlet.tags.form.AbstractFormTag
                  extended by org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
                      extended by org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
                          extended by org.springframework.web.servlet.tags.form.AbstractHtmlElementBodyTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally, EditorAwareTag
Direct Known Subclasses:
ErrorsTag, OptionTag

public abstract class AbstractHtmlElementBodyTag
extends AbstractHtmlElementTag
implements javax.servlet.jsp.tagext.BodyTag

Convenient super class 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:
Serialized Form

Field Summary
 
Fields inherited from class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
CLASS_ATTRIBUTE, DIR_ATTRIBUTE, LANG_ATTRIBUTE, ONCLICK_ATTRIBUTE, ONDBLCLICK_ATTRIBUTE, ONKEYDOWN_ATTRIBUTE, ONKEYPRESS_ATTRIBUTE, ONKEYUP_ATTRIBUTE, ONMOUSEDOWN_ATTRIBUTE, ONMOUSEMOVE_ATTRIBUTE, ONMOUSEOUT_ATTRIBUTE, ONMOUSEOVER_ATTRIBUTE, ONMOUSEUP_ATTRIBUTE, STYLE_ATTRIBUTE, TABINDEX_ATTRIBUTE, TITLE_ATTRIBUTE
 
Fields inherited from class org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
COMMAND_NAME_VARIABLE_NAME, NESTED_PATH_VARIABLE_NAME
 
Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
AbstractHtmlElementBodyTag()
           
 
Method Summary
 int doEndTag()
          If rendering, flush any buffered BodyContent or, if no BodyContent is supplied, render the default content.
 void doFinally()
          Clean up any attributes and stored resources.
 void doInitBody()
           
protected  void exposeAttributes()
          Called during writeTagContent(org.springframework.web.servlet.tags.form.TagWriter) allowing subclasses to add any attributes to the PageContext as needed.
protected  void flushBufferedBodyContent(javax.servlet.jsp.tagext.BodyContent bodyContent)
          The user customised the output of the error messages - flush the buffered content into the main JspWriter.
protected  void onWriteTagContent()
          Called at the start of writeTagContent(org.springframework.web.servlet.tags.form.TagWriter) allowing subclasses to perform any precondition checks or setup tasks that might be necessary.
protected  void removeAttributes()
          Called by doFinally() allowing subclasses to remove any attributes from the PageContext as needed.
protected abstract  void renderDefaultContent(TagWriter tagWriter)
           
protected  void renderFromBodyContent(javax.servlet.jsp.tagext.BodyContent bodyContent, TagWriter tagWriter)
          Render the tag contents based on the supplied BodyContent.
 void setBodyContent(javax.servlet.jsp.tagext.BodyContent bodyContent)
           
protected  boolean shouldRender()
          Should rendering of this tag proceed at all.
protected  int writeTagContent(TagWriter tagWriter)
          Subclasses should implement this method to perform tag content rendering.
 
Methods inherited from class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
getCssClass, getCssErrorClass, getCssStyle, getDir, getDynamicAttributes, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getTabindex, getTitle, isValidDynamicAttribute, resolveCssClass, setCssClass, setCssErrorClass, setCssStyle, setDir, setDynamicAttribute, setLang, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setTabindex, setTitle, writeDefaultAttributes, writeOptionalAttributes
 
Methods inherited from class org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
autogenerateId, convertToDisplayString, getBindStatus, getBoundValue, getEditor, getId, getName, getNestedPath, getPath, getPropertyEditor, getPropertyPath, processFieldValue, resolveId, setId, setPath
 
Methods inherited from class org.springframework.web.servlet.tags.form.AbstractFormTag
createTagWriter, doStartTagInternal, evaluate, evaluateBoolean, getDisplayString, getDisplayString, isDefaultHtmlEscape, writeOptionalAttribute
 
Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
isHtmlEscape, setHtmlEscape
 
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doStartTag, getRequestContext
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getParent, getValue, getValues, release, removeValue, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.IterationTag
doAfterBody
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
doStartTag, getParent, release, setPageContext, setParent
 

Constructor Detail

AbstractHtmlElementBodyTag

public AbstractHtmlElementBodyTag()
Method Detail

writeTagContent

protected int writeTagContent(TagWriter tagWriter)
                       throws javax.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:
javax.servlet.jsp.JspException

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
If rendering, flush any buffered BodyContent or, if no BodyContent is supplied, render the default content.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
Tag#EVAL_PAGE
Throws:
javax.servlet.jsp.JspException

renderFromBodyContent

protected void renderFromBodyContent(javax.servlet.jsp.tagext.BodyContent bodyContent,
                                     TagWriter tagWriter)
                              throws javax.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:
javax.servlet.jsp.JspException

doFinally

public void doFinally()
Clean up any attributes and stored resources.

Specified by:
doFinally in interface javax.servlet.jsp.tagext.TryCatchFinally
Overrides:
doFinally in class AbstractDataBoundFormElementTag

onWriteTagContent

protected void onWriteTagContent()
Called at the start of writeTagContent(org.springframework.web.servlet.tags.form.TagWriter) allowing subclasses to perform any precondition checks or setup tasks that might be necessary.


shouldRender

protected boolean shouldRender()
                        throws javax.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:
javax.servlet.jsp.JspException

exposeAttributes

protected void exposeAttributes()
                         throws javax.servlet.jsp.JspException
Called during writeTagContent(org.springframework.web.servlet.tags.form.TagWriter) allowing subclasses to add any attributes to the PageContext as needed.

Throws:
javax.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(javax.servlet.jsp.tagext.BodyContent bodyContent)
                                 throws javax.servlet.jsp.JspException
The user customised the output of the error messages - flush the buffered content into the main JspWriter.

Throws:
javax.servlet.jsp.JspException

renderDefaultContent

protected abstract void renderDefaultContent(TagWriter tagWriter)
                                      throws javax.servlet.jsp.JspException
Throws:
javax.servlet.jsp.JspException

doInitBody

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

setBodyContent

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

Spring Framework