Oliver Suciu wrote:

> In JSP 1.1, you simply cook your own try-catch-finally stuff,
> preferrably in a generic base tag, which all your concrete
> tags extend.


Unfortunately that's not possible in JSP 1.1. If there's an
exception while the custom action's body is processed, the
page processing is aborted and the doEndTag() method is never
called, just like Andrew said. Again, TryCatchFinally in JSP 1.2
was added specifically to address this problem.

Hans

> Hans Bergsten wrote:
>
>>Andrew Cooke wrote:
>>
>>
>>>Hi,
>>>
>>>I would like to use a Custom Tag to open resources in the start tag and free
>>>them in the closing tag.  But if there is an exception in the enclosed body,
>>>it seems that I will leak the resource (as the closing tag will not be
>>>called).
>>>
>>>For example, if I open a database connection in doStartTag and fail to close
>>>it in doEndTag (because an exception was thrown) then I will have an open DB
>>>connection that is not returned to the pool.
>>>
>>>What is the best way to avoid this problem?
>>>
>>This is exactly what the TryCatchFinally interface is for, added
>>in JSP 1.2. For a JSP 1.1 container, I'm afraid there is no solution.
>>
>>Hans
>>--
>>Hans Bergsten           [EMAIL PROTECTED]
>>Gefion Software         http://www.gefionsoftware.com
>>JavaServer Pages        http://TheJSPBook.com
>>
>>===========================================================================
>>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>>Some relevant FAQs on JSP/Servlets can be found at:
>>
>> http://archives.java.sun.com/jsp-interest.html
>> http://java.sun.com/products/jsp/faq.html
>> http://www.esperanto.org.nz/jsp/jspfaq.jsp
>> http://www.jguru.com/faq/index.jsp
>> http://www.jspinsider.com
>>
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>
>


--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
JavaServer Pages        http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to