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

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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic