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.
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....