• Post Reply Bookmark Topic Watch Topic
  • New Topic

exception in doAfterBody

 
Hendy Setyo Mulyo
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

Let's say there is an exception occured in doAfterBody of IterationTag implementation and it doesnt try-catched, would the doEndTag still be called by the container?
Thanks.
 
Dagbj�rn Nogva
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Hendy,

I believe the short answer is no.

The following is copied from the javadoc of the TryCatchFinally interface, an auxiliary interface that a Tag, an IterationTag or a BodyTag can implement. doAfterBody should be called somewhere between doStartTag and doEndTag, so any exceptions here will cause doEndTag to be skipped.



This is also supported by the JSP 2.0 spec, page 2-52, The Tag Interface.

If an exception is encountered during the evaluation of the body of a tag, its doEndTag method will not be evaluated. See the TryCatchFinally tag for methods that are guaranteed to be evaluated.


HTH,
Dagbj�rn
 
Hendy Setyo Mulyo
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Dagbj�rn
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!