Servlet and JavaServer Pages API Documentation: Interface BodyTag

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.servlet.jsp.tagext
Interface BodyTag

All Superinterfaces:
  Tag

All Known Implementing Classes:
  BodyTagSupport

public interface BodyTag
extends Tag

The BodyTag interface extends Tag by defining additional methods that let a Tag handler access its body.

The interface provides two new methods: one is to be invoked with the BodyContent for the evaluation of the body, the other is to be reevaluated after every body evaluation.

Without repeating the portions described in Tag.java, a typical invocation sequence is:

     -- we are picking up after all the setters have been done
     t.doStartTag();
     out = pageContext.pushBody();
     -- prepare for body
     t.setBodyContent(out);
     -- preamble
     t.doBodyInit();
     -- BODY evaluation into out
     t.doAfterBody();
     -- while doAfterBody returns EVAL_BODY_TAG we iterate
     -- BODY evaluation into out
     t.doAfterBody()
     -- done
     t.doEndTag()

Field Summary
`static int` | `EVAL_BODY_TAG` Request the creation of new BodyContent on which to evaluate the body of this tag.

Fields inherited from interface javax.servlet.jsp.tagext.Tag
`EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

Method Summary
`int` | `doAfterBody()` Actions after some body has been evaluated.
`void` | `doInitBody()` Prepare for evaluation of the body.
`void` | `setBodyContent(BodyContent b)` Setter method for the bodyContent property.

Methods inherited from interface javax.servlet.jsp.tagext.Tag
`doEndTag, doStartTag, getParent, release, setPageContext, setParent`

Field Detail

### EVAL_BODY_TAG

    public static final int EVAL_BODY_TAG

  Request the creation of new BodyContent on which to evaluate the body of this tag. Returned from doStartTag and doAfterBody. This is an illegal return value for doStartTag when the class does not implement BodyTag, since BodyTag is needed to manipulate the new Writer.

Method Detail

### setBodyContent

    public void setBodyContent(BodyContent b)

  Setter method for the bodyContent property.

  This method will not be invoked if there is no body evaluation.

  Parameters:
    `b` - the BodyContent

### doInitBody

    public void doInitBody()
                    throws JspException

  Prepare for evaluation of the body.

  The method will be 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 tag's body into that BodyContent.

  This method will not be invoked if there is no body evaluation.

### doAfterBody

    public int doAfterBody()
                    throws JspException

  Actions after some body has been evaluated.

  Not invoked in empty tags or in tags returning SKIP_BODY in doStartTag() This method is invoked after every body evaluation. The pair "BODY -- doAfterBody()" is invoked initially if doStartTag() returned EVAL_BODY_TAG, and it is repeated as long as the doAfterBody() evaluation returns EVAL_BODY_TAG

  The method re-invocations may be lead to different actions because there might have been some changes to shared state, or because of external computation.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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