aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ : page:553 Q:9 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ : page:553 Q:9" Watch "HFSJ : page:553 Q:9" New topic
Author

HFSJ : page:553 Q:9

Sanjay pts
Ranch Hand

Joined: Nov 07, 2000
Posts: 357
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


Eat JAVA, Drink JAVA, Sleep Java
Vengan Krish
Ranch Hand

Joined: Mar 05, 2005
Posts: 32
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.


SCJP 1.4<br />SCJD 1.4<br />SCWCD 1.4<br />SWBCD (Preparing)
Sanjay pts
Ranch Hand

Joined: Nov 07, 2000
Posts: 357
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
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
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 ]

Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
osman cinar eren
Ranch Hand

Joined: Jan 25, 2005
Posts: 78
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.


SCJP/SCWCD
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
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
osman cinar eren
Ranch Hand

Joined: Jan 25, 2005
Posts: 78
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HFSJ : page:553 Q:9