public interface BodyTag extends IterationTag
if (tag.doStartTag() == EVAL_BODY_TAG) {
out = pageContext.pushBody();
tag.setBodyContent(out);
tag.doInitBody();
do {
...
} while (tag.doAfterBody() == EVAL_BODY_AGAIN);
out = pageContent.popBody();
}
if (tag.doEndTag() == SKIP_PAGE)
return;
Modifier and Type | Field and Description |
---|---|
static int |
EVAL_BODY_BUFFERED
Constant returned by doStartTag to evaluate a tag body.
|
static int |
EVAL_BODY_TAG
Deprecated.
|
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Modifier and Type | Method and Description |
---|---|
int |
doAfterBody()
Tags call doAfterBody after processing the tag body.
|
void |
doInitBody()
Tags call doInitBody before processing the tag body.
|
void |
setBodyContent(BodyContent out)
Sets the BodyContent stream.
|
doEndTag, doStartTag, getParent, release, setPageContext, setParent
static final int EVAL_BODY_TAG
static final int EVAL_BODY_BUFFERED
void setBodyContent(BodyContent out)
out
- The body content for tag and its contents.void doInitBody() throws JspException
empty tags and tags returning SKIP_BODY do not call doInitBody and doAfterBody.
if (tag.doStartTag() == EVAL_BODY_TAG) {
out = pageContext.pushBody();
tag.setBodyContent(out);
tag.doInitBody();
...
}
JspException
int doAfterBody() throws JspException
empty tags and tags returning SKIP_BODY do not call doInitBody and doAfterBody.
Here's an example of a tag that copies its contents to the output (assuming setBodyContent sets bodyOut):
public int doAfterBody() throws JspException
{
try {
bodyOut.writeOut(bodyOut.getEnclosingWriter());
} catch (IOException e) {
throw JspException(String.valueOf(e));
}
return SKIP_PAGE;
}
doAfterBody
in interface IterationTag
JspException