• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF Chapter 10, Q12 question

 
David Jones
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 554, question 12,

Which is true about the lifecycle of a Simple tag? The answer is C :

C. The setParent and setJspContext methods are called immediately before the tag attributes are set.

However, on page 506 :

"If the tag is nested, call the setParent(JspTag) method."

So if the tag is not nested, no setParent(JspTag) will be called. So I think that C is also not correct (since the question did not mention the tag is nested). Am I right? Or am I missing something?

Thanks
David



Thanks
David
 
David Jones
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Could anyone help me with this question?

Thanks
David
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David Jones:
On page 554, question 12,

Which is true about the lifecycle of a Simple tag? The answer is C :

C. The setParent and setJspContext methods are called immediately before the tag attributes are set.

However, on page 506 :

"If the tag is nested, call the setParent(JspTag) method."

So if the tag is not nested, no setParent(JspTag) will be called. So I think that C is also not correct (since the question did not mention the tag is nested). Am I right? Or am I missing something?

Thanks
David



Thanks
David




can you post the entire question, if possible?

but anyway, without looking at the entire question, i can say that, all the other options other that C are false.

C is true because it is a general statement that includes both situations where the tag is nested or not. Like below, rewritten as,

"C. The setParent(if tag is nested) and setJspContext methods are called immediately before the tag attributes are set."
 
David Jones
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Page 554, Q12 is as follows :

Which is true about the lifecycle of a Simple Tag?
A. The release method is called after the doTag method.
B. The setJspBody method is always called before the doTag method
C. The setParent and setJspContext methods are called immediately before the tag attributes are set
D. The JspFragment of the tag body is invoked by the Container before the tag handler's doTag method is called. This value, a BodyContent object, is passed to the tag handler using the setJspBody method.

Answer : C
 
David Jones
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jesus Angeles,

I also think that if the answer C include the class is nested, then option C is correct. This is because setParent is not 100% be invoked.

David
 
Leigh Su
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David Jones:
In Page 554, Q12 is as follows :

Which is true about the lifecycle of a Simple Tag?
A. The release method is called after the doTag method.
B. The setJspBody method is always called before the doTag method
C. The setParent and setJspContext methods are called immediately before the tag attributes are set
D. The JspFragment of the tag body is invoked by the Container before the tag handler's doTag method is called. This value, a BodyContent object, is passed to the tag handler using the setJspBody method.

Answer : C

I also think that if the answer C include the class is nested, then option C is correct. This is because setParent is not 100% be invoked.



Hi everyone:
I have the same feeling with David. Can anybody clear the answer C? Or the answer C is wrong?

Thx.

Leigh
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Jesus Angeles says, its right
"C is true because it is a general statement that includes both situations where the tag is nested or not."
 
Leigh Su
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gaurav Gambhir:
As Jesus Angeles says, its right
"C is true because it is a general statement that includes both situations where the tag is nested or not."


Hi Gaurav:

Thank you for the reply. I fully understand that C is right comparing with other three choices. How about there's another right choice, should I choose it again?
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which other option according to you is right , to me it looks, as book is giving explanation to all other wrong options.
 
Leigh Su
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gaurav:

Thank you for the reply again. What I mean is given another question, and it includes the above-mentioned C statement, there is another right statement. the request is to choose all right. According to this suppose, should I choose above-mentioned C statement?
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can choose option C if its a generic way of asking the question, but if it specifically says tag has no body then, option C would be wrong.
 
Leigh Su
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see.
Thx alot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic