File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes mock exam question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "mock exam question" Watch "mock exam question" New topic
Author

mock exam question

Mark heningen
Greenhorn

Joined: Mar 25, 2010
Posts: 25
Hi,
I was attempting one mock exam from
http://www.javabeat.net/cert/scwcd-5-0/mock-exams/scwcd_mock_exam_questions_3.php
1. Regarding the processing of a BodyTag handler, in which of the following cases a BodyContent object will be "pushed" into the pageContext?
Select 1 correct option.
A.If the doStartTag() returns EVAL_BODY_INCLUDE
B.If the doStartTag() returns EVAL_BODY_BUFFERED
C.If the doStartTag() returns SKIP_BODY
D.If the doStartTag() DOES NOT return SKIP_BODY
E.A BodyContent object it is always created and pushed no matter what doStartTag() returns
correct answer is C
i think that it should be B.
any views?
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

If you SKIP_BODY you won't process the BodyContent. And the question says "object will be pushed into the pageContext", in other words, "the object will be processed (or evaluated)".


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1521
    
  22

Hi Mark, Hebert,

in which of the following cases a BodyContent object will be "pushed" into the pageContext?

I find this question rather vague. First of all a BodyContent object is only created when the doStartTag() method returns EVAL_BODY_BUFFERED.

The next thing is that, when you read the API of the PageContext:
public BodyContent pushBody()
Return a new BodyContent object, save the current "out" JspWriter, and update the value of the "out" attribute in the page scope attribute namespace of the PageContext.
public JspWriter popBody()
Return the previous JspWriter "out" saved by the matching pushBody(), and update the value of the "out" attribute in the page scope attribute namespace of the JspContext.

So I would say: the BodyContent is pushed from the PageContext (by calling pushBody()) and handed over to your TagHandler code, and never into.

My first reaction would be answer B, but questions remain about the question itself....

Regards,
Frits
 
wood burning stoves
 
subject: mock exam question
 
Similar Threads
Doubt in doAfterBody
Eduardo Mock Exam : No. 24
BodyTag doubt
Return type for BodyTagSupport
BodyTagSupport's return value EVAL_BODY_BUFFERED