tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <mdigg...@latte.harvard.edu>
Subject Re: missing if/else syntax (What about catch?)
Date Fri, 09 May 2003 00:27:38 GMT
Oh boy, got to get in on this one!

So! What about "catch" folks??? Here we have a tag I've seldom found a 
use for. How am I supposed to use this tag? Seems counter-intuitive to 
not have a try block, doesn't it. On top of this, there is no fine 
grained control of exception catching in the catch tag, how do I catch 
one exception, but not another?

I wrote my own taglib for exception handling thats container based:

<ex:exception>
    <ex:try>
	<!-- do something risky -->
    </ex:try>
    <ex:catch var="foo" class="your.own.Exception">
         <c:out value="${foo.message}"/>
    </ex:catch>
    <ex:catch var="bar" class="java.lang.Exception">
	<%=bar.getMessage()%>
    </ex:catch>
</ex:exception>


This works great for providing content for different exception cases, or 
possibly redirecting/forwarding to other jsp's/servlets/error pages for 
the different cases. It adheres to the try/catch paradigm, and to the 
container like structure of choose.

-Mark

 > Pierre IS JSTL. Shawn is his obedient servant.
 >
 > Think Count Dracula and Igor.
 >
 > The rest of the expert group are their zombie army.

p.s. I think a better analogy might be Dr. Frankenstein and his 
assistant, Fritz! ITS ALIVE!!!!!!! JSTL, ITS ALIVE!!!!!


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message