javax.servlet.jsp.tagext
Interface BodyTag
- Tag
- BodyTagSupport
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()
static int | EVAL_BODY_TAG - Request the creation of new BodyContent on which to evaluate the
body of this tag.
|
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.
- 2
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.
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.
setBodyContent
public void setBodyContent(BodyContent b)
Setter method for the bodyContent property.
This method will not be invoked if there is no body evaluation.
b
- the BodyContent
Copyright © 1999-2000 The Apache Software Foundation. All Rights Reserved.