Name

BodyTag

Synopsis

The BodyTag interface extends the IterationTag interface. It must be implemented by classic tag handler classes that need access to the body contents of the corresponding custom action element, for instance in order to perform a transformation of the contents before it’s included in the response. A tag handler that implements this interface must return EVAL_BODY_BUFFERED from doStartTag( ) to tell the container to capture the result of evaluating the body. It can also return EVAL_BODY_AGAIN from doAfterBody( ) to tell the container to evaluate the body again and capture the result.

Unless you need to allow scripting elements in the corresponding custom action element body, I recommend that you use the SimpleTag interface instead.

Synopsis

Interface name:

javax.servlet.jsp.tagext.BodyTag

Extends:

javax.servlet.jsp.tagext.IterationTag

Implemented by:

Custom action tag handler classes and javax.servlet.jsp.tagext.BodyTagSupport

Fields

public static final int EVAL_BODY_BUFFERED

Methods

public void doInitBody( ) throws JspException

Prepares for evaluation of the body. This method is invoked once per action invocation by the page implementation after a new BodyContent has been obtained and set on the tag handler via the setBodyContent( ) method and before the evaluation of the element’s body.

This method isn’t invoked if the element body is empty or if doStartTag( ) returns SKIP_BODY.

public void setBodyContent(BodyContent b)

Sets the BodyContent created for this ...

Get JavaServer Pages, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.