• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding tags

 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If an exception is thrown in doStartTag(),then doEndTag() wont be evaluated .In this case,will release() be called?Is release() like finally ,then what is the TryCatchFinally interface for?
Thanx.
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I haven't a servlet engine on my desktop at this moment, but I suggest you to write a System.out.println in your release() and look the behaviour...
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this thread in JSP.
Basically, you can't guarantee that release() will be called when an exception is thrown, however you can guarantee what will happen when you implement TryCatchFinally.
However, saying that, most containers simply dump the tag handler instances if an exception is thrown since the state of the tag handler might be corrupted in some way and it's often safer to not reuse it.
In essence, don't rely on the release() method.
HTH
Simon
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!