javax.servlet.jsp.tagext
Class BodyTagSupport
java.lang.Object
|
+--javax.servlet.jsp.tagext.TagSupport
|
+--javax.servlet.jsp.tagext.BodyTagSupport
- public class BodyTagSupport
- extends TagSupport
- implements BodyTag
- See Also:
- Serialized Form
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()
setBodyContent
public void setBodyContent(BodyContent bodyContent)
- Description copied from interface: BodyTag
- Sets the BodyContent stream. A tag calls setBodyContent before calling
doInitBody()
- Specified by:
- setBodyContent in interface BodyTag
- Tags copied from interface: BodyTag
- Parameters:
out
- The body content for tag and its contents.
getBodyContent
public BodyContent getBodyContent()
getPreviousOut
public JspWriter getPreviousOut()
doStartTag
public int doStartTag()
throws JspException
- Description copied from interface: Tag
- Callback to handle the start of a tag.
- Overrides:
- doStartTag in class TagSupport
- Tags copied from interface: Tag
- Returns:
- SKIP_BODY to ignore the body and EVAL_BODY_INCLUDE
to evaluate the body.
doInitBody
public void doInitBody()
throws JspException
- Description copied from interface: BodyTag
- Tags call doInitBody before processing the tag body. doInitBody is
called after setBodyContent. It is called only once for each tag, even
if the tag loops.
empty tags and tags returning SKIP_BODY do not call
doInitBody and doAfterBody.
if (tag.doStartTag() == EVAL_BODY_TAG) {
out = pageContext.pushBody();
tag.setBodyContent(out);
tag.doInitBody();
...
}
- Specified by:
- doInitBody in interface BodyTag
doAfterBody
public int doAfterBody()
throws JspException
- Description copied from interface: BodyTag
- Tags call doAfterBody after processing the tag body. Tags writing
to the output stream must write the body to the enclosing JspWriter.
Tags can loop by returning EVAL_PAGE and stop by returning SKIP_PAGE.
empty tags and tags returning SKIP_BODY do not call
doInitBody and doAfterBody.
Here's an example of a tag that copies its contents
to the output (assuming setBodyContent sets bodyOut):
public int doAfterBody()
{
bodyOut.writeOut(bodyOut.getEnclosingWriter());
return SKIP_PAGE;
}
- Specified by:
- doAfterBody in interface BodyTag
- Tags copied from interface: BodyTag
- Returns:
- EVAL_PAGE to repeat the tag and SKIP_PAGE to stop.
release
public void release()
- Description copied from interface: Tag
- Cleans up the tag at the end of the page. The same tag instance
might be reused for multiple tags in the page.
- Overrides:
- release in class TagSupport