• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

mock exam question

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)".
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic