• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doEndTag method

 
geet rahane
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all.......

I have one query about doEndTag method....I get confused after reading the explanation from jwebplus mock exam


Q..In which of the following cases will the method doEndTag() of a tag handler be invoked?
answer given is:: It will be invoked only if doStartTag() and doAfterBody() complete successfully.
explanation:
The container invokes this method as an indication that it is finishing up the processing of the tag. It is always called after finishing doStartTag (and doAfterBody(), if applicable).
Obviously, if these methods throw an exception, the normal flow of execution of the container will be disrupted and this method won't be called.

and in other question explanation it is given that You cannot avoid doEndTag(). This method will always be called by the container in the end ............

so i get confused,,,,,,,whether doEndTag always run or in case of exception it is not executed???
 
Chinmaya Chowdary
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Geet. If we catch the exception doEndTag() always run. To test this, use System.out.println() in doEndTag().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic