| Author |
In what methods can we write to the page in case of a BodyTagSupport
|
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1040
|
|
If I extend the BodyTagSupport for defining my own classic custom tag.
Can I then write the body to the page-output in any of the following methods?
doInitBody()doAfterBody()doEndTag()
by using
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
Did you try doing this??
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1040
|
|
I have just tried it and the outcome is quite interesting:
doInitBody() - not printabledoAfterBody() - body printabledoEndTag() - body printable
It seems that the BodyContent is not available before the first evaluation of the body!
this was my code (default behaviour of the BodyTagSupport is that the doStartTag() returns EVAL_BODY_BUFFERED so that we are sure that all 3 methods are called)
The calling JSP:
and the following TLD entry:
and the following output:
doInit()doAfterBody()doEndTag()
|
 |
 |
|
|
subject: In what methods can we write to the page in case of a BodyTagSupport
|
|
|