javax.servlet.jsp.tagext
Class BodyTagSupport
java.lang.Object
|
+--javax.servlet.jsp.tagext.TagSupport
|
+--javax.servlet.jsp.tagext.BodyTagSupport
- All Implemented Interfaces:
- BodyTag, java.io.Serializable, Tag
- public class BodyTagSupport
- extends TagSupport
- implements BodyTag
Convenience class defining default behavior for a BodyTag. Most
implementations will extend BodyTagSupport instead of implementing
BodyTag directly.
The default behavior executes the body once, ignoring the contents.
- See Also:
- Serialized Form
Constructor Summary |
BodyTagSupport()
Implementing tags must implement a zero-arg constructor. |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
bodyContent
protected BodyContent bodyContent
BodyTagSupport
public BodyTagSupport()
- Implementing tags must implement a zero-arg constructor.
setBodyContent
public void setBodyContent(BodyContent bodyContent)
- Called by the JSP engine just before calling doInitBody(). Empty
tags never have setBodyContent called on them. Because the JSP
engine reuses BodyContents, a tag cannot use the body content after
doAfterBody completes.
- Specified by:
setBodyContent
in interface BodyTag
- Parameters:
bodyContent
- a bodyContent generated by the JSP engine.
getBodyContent
public BodyContent getBodyContent()
- Returns the tag's body content. The body content is in scope for
the BodyTag methods doInitBody and doAfterBody, but not for the
tag methods doStartTag and doEndTag.
getPreviousOut
public JspWriter getPreviousOut()
- Returns the enclosing writer. For BodyTags with no body, this is
equivalent to pageContext.getOut().
doStartTag
public int doStartTag()
throws JspException
- The default start action is EVAL_BODY_TAG, i.e. evaluate the body.
- Specified by:
doStartTag
in interface Tag
- Overrides:
doStartTag
in class TagSupport
- Following copied from interface:
javax.servlet.jsp.tagext.Tag
- Returns:
- SKIP_BODY to ignore the body and EVAL_BODY_INCLUDE
to evaluate the body.
doInitBody
public void doInitBody()
throws JspException
- The default init action is to do nothing.
- Specified by:
doInitBody
in interface BodyTag
doAfterBody
public int doAfterBody()
throws JspException
- Action after the body completes, returning EVAL_BODY_TAG to loop and
SKIP_BODY to stop looping.
The default action is to only execute the body once.
- Specified by:
doAfterBody
in interface BodyTag
- Following copied from interface:
javax.servlet.jsp.tagext.BodyTag
- Returns:
- EVAL_PAGE to repeat the tag and SKIP_PAGE to stop.
release
public void release()
- Release the tag.
- Specified by:
release
in interface Tag
- Overrides:
release
in class TagSupport