Name

BodyTag Interface

Interface name:

javax.servlet.jsp.tagext.BodyTag

Extends:

javax.servlet.jsp.tagext.Tag

Implemented by:

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

Description

The BodyTag interface must be implemented by 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 they are included in the response. This interface must also be implemented by tag handlers that need to iterate over the body of a custom action element.

Methods

public int doAfterBody() throws JspException

Performs actions after the body has been evaluated. This method is invoked after every body evaluation. If this method returns EVAL_BODY_TAG the body is evaluated again, typically after changing the values of variables used in it. If it returns SKIP_BODY, the processing continues with a call to doEndTag().

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

public void doInitBody() throws JspException

Prepares for evaluation of the body. This method is invoked by the page implementation once per action invocation, 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 is not invoked if the element body is empty or if doStartTag() returns SKIP_BODY.

public void setBodyContent(BodyContent b)

Sets the BodyContent ...

Get JavaServer Pages Pocket Reference 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.