Forums Register Login

HFSJ : page:553 Q:9

+Pie Number of slices to send: Send
public class bufTag extends BodyTagSupport
{
public int doStartTag() throws JspException {
//INSERT CODE HERE
}
}

Assume that tag has properly Configured to allow body-content.
Which,if inserted at line // would cause jsp code
<mytags:mytag>BodyContent</mytags:mytag>
to output bodyContent?

A. return SKIP_BODY;
B. return EVAL_BODY_INCLUDE
C. return EVAL_BODY_BUFFERED
D. return BODY_CONTENT

they said answer B
but i think answer C

Can anybody exapin me this please.

Thanx
sanjay
+Pie Number of slices to send: Send
Answer B is correct.
Only when you return EVAL_BODY_INCLUDE your body will be processed.
You return EVAL_BODY_PROCESSED when you need access to the body for your own manipulation.
Check out the lifecycle chart on HFS page 533.

Regards.
+Pie Number of slices to send: Send
You return EVAL_BODY_BUFFERED when you need access to the body for your own manipulation.

I read the same but can u plz tell me which kind of our own manupulations???..
Can u plz expain it me in detail with example
Help will be appriciated.
Thanx in advance
sanjay
+Pie Number of slices to send: Send
Hi,

If we return EVAL_BODY_BUFFERED, a new buffer, an instance of body BodyContent is created and is available for further processing. we can simply get writer from the BodyContent object and print the content or make chages in the content.

Thanks
[ June 05, 2005: Message edited by: Narendra Dhande ]
+Pie Number of slices to send: Send
I guess both B and C are correct. If you look at the process diagram on page 533, with EVAL_BODY_BUFFERED, after the 2 methods are called, the body is evaluated.
+Pie Number of slices to send: Send
As I understand it, C (EVAL_BODY_BUFFERED) is not really a correct answer because while it might output the body, that really depends on the code written to process the body. And if you go through the extra effort to write that code, chances are you're not going to just take the body and dump it into the output without at least some filtering.

-Yuriy
+Pie Number of slices to send: Send
from the jsp spec 13.2.2 :

If EVAL_BODY_BUFFERED is returned, and the custom action element is not
empty, setBodyContent() is invoked, doInitBody() is invoked, the body is evaluated,
doAfterBody() is invoked, and then, after zero or more iterations, doEnd-
Tag() is invoked. If the custom action element is empty, only doStart() and
doEndTag() are invoked.
Are you okay? You look a little big. Maybe this tiny ad will help:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 836 times.
Similar Threads
info on BodyTagSupport
Custom Tags
Doubts in MockExam HFSJ
Question from Head First book chapter 10
HF Custom Tag question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 03:12:34.