Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doAfterBody() doubt

 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In which of the following cases doAfterBody() is invoked?

1)This method will always be called when the body of the tag is not empty.
2)This method will be called only when the body of the tag IS empty.
3)This method will be called only when doStartTag() returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED.
4)This method will be called only when doEndTag() returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED.
5)This method will be called if doAfterBody() returns IterationTag.EVAL_BODY_AGAIN.

Answer Option 5. Why not option 3 also?

Thanks
Srividhya
 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srividhya ,

Why not option 3 also?

becuase even the doStartTag() returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED , if body is empty then doAfterBody() mehtod will not be called.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks chintu
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chintu

Thanks for your reply. doStartTag() should not return EVAL_BODY_INCLUDE & EVAL_BODY_BUFFERED if the body-content is empty. so eventually doAfterBody() will not be called.

Srividhya
 
Paulo Marcio Brandi Rezende
Ranch Hand
Posts: 34
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that even doStartTag() returns EVAL_BODY_INCLUDE or EVAL_BODY_BUFFERED, the doAfterBody() will not be called if the body is empty.

But the option 3 says:

This method will be called only when doStartTag() returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED.

It doesn't say:

This method will be called always that doStartTag() returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED.

The options hadn't been written properly.
[ August 06, 2008: Message edited by: Paulo Rezende ]
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paulo

Then the right answer should be option 3 & 5 right?

Srividhya
 
Paulo Marcio Brandi Rezende
Ranch Hand
Posts: 34
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srividhya,

I agree. I hope don't see this kind of question with dubious answer options in the exam.
 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paulo ,
Originally posted by Paulo Rezende:
[QB]I agree that even doStartTag() returns EVAL_BODY_INCLUDE or EVAL_BODY_BUFFERED, the doAfterBody() will not be called if the body is empty.

But the option 3 says:

This method will be called only when doStartTag() returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED.

It doesn't say:

This method will be called always that doStartTag() returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED.

The options hadn't been written properly.

[QB]


Here the point is not finding only or always that. off course your correct statement is not written properly. But doAfterBody() will not be called if the body is empty and doStartTag()returns any retrun value. This option is wrong.

Ranchers can some one correct me If I'm wrong.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic