javax.servlet.jsp.tagext

Class BodyTagSupport

Implemented Interfaces:
BodyTag, IterationTag, JspTag, Serializable, Tag

public class BodyTagSupport
extends TagSupport
implements BodyTag

A base class for defining tag handlers implementing BodyTag.

The BodyTagSupport class implements the BodyTag interface and adds additional convenience methods including getter methods for the bodyContent property and methods to get at the previous out JspWriter.

Many tag handlers will extend BodyTagSupport and only redefine a few methods.

Field Summary

protected BodyContent
bodyContent
The current BodyContent for this BodyTag.

Fields inherited from class javax.servlet.jsp.tagext.TagSupport

id, 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

BodyTagSupport()
Default constructor, all subclasses are required to only define a public constructor with the same signature, and to call the superclass constructor.

Method Summary

int
doAfterBody()
After the body evaluation: do not reevaluate and continue with the page.
int
doEndTag()
Default processing of the end tag returning EVAL_PAGE.
void
doInitBody()
Prepare for evaluation of the body just before the first body evaluation: no action.
int
doStartTag()
Default processing of the start tag returning EVAL_BODY_BUFFERED.
BodyContent
getBodyContent()
Get current bodyContent.
JspWriter
getPreviousOut()
Get surrounding out JspWriter.
void
release()
Release state.
void
setBodyContent(BodyContent b)
Prepare for evaluation of the body: stash the bodyContent away.

Methods inherited from class javax.servlet.jsp.tagext.TagSupport

doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue

Field Details

bodyContent

protected BodyContent bodyContent
The current BodyContent for this BodyTag.

Constructor Details

BodyTagSupport

public BodyTagSupport()
Default constructor, all subclasses are required to only define a public constructor with the same signature, and to call the superclass constructor. This constructor is called by the code generated by the JSP translator.

Method Details

doAfterBody

public int doAfterBody()
            throws JspException
After the body evaluation: do not reevaluate and continue with the page. By default nothing is done with the bodyContent data (if any).
Specified by:
doAfterBody in interface IterationTag
Overrides:
doAfterBody in interface TagSupport
Returns:
SKIP_BODY
Throws:
JspException - if an error occurred while processing this tag
See Also:
doInitBody(), BodyTag

doEndTag

public int doEndTag()
            throws JspException
Default processing of the end tag returning EVAL_PAGE.
Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in interface TagSupport
Returns:
EVAL_PAGE
Throws:
JspException - if an error occurred while processing this tag

doInitBody

public void doInitBody()
            throws JspException
Prepare for evaluation of the body just before the first body evaluation: no action.
Specified by:
doInitBody in interface BodyTag
Throws:
JspException - if an error occurred while processing this tag

doStartTag

public int doStartTag()
            throws JspException
Default processing of the start tag returning EVAL_BODY_BUFFERED.
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in interface TagSupport
Returns:
EVAL_BODY_BUFFERED
Throws:
JspException - if an error occurred while processing this tag
See Also:
BodyTag

getBodyContent

public BodyContent getBodyContent()
Get current bodyContent.
Returns:
the body content.

getPreviousOut

public JspWriter getPreviousOut()
Get surrounding out JspWriter.
Returns:
the enclosing JspWriter, from the bodyContent.

release

public void release()
Release state.
Specified by:
release in interface Tag
Overrides:
release in interface TagSupport
See Also:
Tag.release()

setBodyContent

public void setBodyContent(BodyContent b)
Prepare for evaluation of the body: stash the bodyContent away.
Specified by:
setBodyContent in interface BodyTag
Parameters:
b - the BodyContent

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.