From: Kishi Mikio <[EMAIL PROTECTED]>
Subject: pushBody() and popBody() problems in BodyTag
Date: Thu, 06 Feb 2003 21:21:31 +0900 (JST)
> <fmt:bundle basename="test">
> <c:out value="test1" />
> <% if (true) return; %>
> </fmt:bundle>
>
> In above case, I want to print out "test1", but not print out....
> Is it possible to print out string
> between <fmt:bundle> and "return" ?
In order to solve this problem, I implemented <my:return/> tag.
The following code is doEndTag() in the <my:return/>.
public int doEndTag()
throws JspException {
try {
BodyContent body = (BodyContent) pageContext.getOut();
try {
while (true) {
JspWriter writer = pageContext.popBody();
body.writeOut(writer);
body = (BodyContent) writer;
}
} catch (EmptyStackException e) {
// nothing to do
}
} catch (Exception e) {
e.printStackTrace();
throw new JspException(e.toString());
}
return SKIP_PAGE;
}
By using this tag, it became possible to display "test1" string.
But is this the best method ? Is this popBody() usage wrong ?
Is there any other better method ?
Thanks in advance
Mikio Kishi
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]