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

what make doAfterBody() to execute??

 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers,

please consider the following question from the Enthuware mock.

In which of the following cases will the method doAfterBody() of a tag handler be 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.

Mentioned right option is 5. I really shocked to see the correct option by the Enthuware mock. option 5 decide only to evaluate the tag body again OR not.

this method tells the container whether to evaluate the body again or not, simulating a loop. If it returns IterationTag.EVAL_BODY_AGAIN, the container evaluates the body again, otherwise if it returns Tag.SKIP_BODY, the loop ends and the container call doEndTag().

My answer is 3. If EVAL_BODY_BUFFERED is returned, and the custom action element is not empty, setBodyContent() is invoked, doInitBody() is invoked, the body is evaluated, doAfterBody() is invoked, and then, after zero or more iterations, doEndTag() is invoked.

I guess I am clear with the above doubt. I just wanted to verify with ranchers

please provide your feedback
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moreover to become a correct answer for option 5, container should make a call to this method first . Only after it is possible for doAfterBody() method to return EVAL_BODY_AGAIN.
 
ankit kumar
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
even I think so that option 3 should be the right one
 
Sourin K. Sen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option 3 sounds right but it isn't as it is not the ONLY way to have the doAfterBody() method executed. And of course, if doAfterBody() returns IterationTag.EVAL_BODY_AGAIN, it is ONE OF THE WAY to have the doAfterBody() executed, even if that means having it executed again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic