You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Mike Steigerwald <St...@UMich.edu> on 2003/07/27 18:11:09 UTC

Help with catch tag

Hi, all,
[Mike Steigerwald] 

I guess I need a code review. Can anyone see what might be wrong with the
snippet below? It does not seem to catch an exception generated when the
incorrect database password is submitted. 

I'm using the Tomcat server. It's throwing the expected exception, but I
want to catch it myself and give the client a more intelligible error
message. 

My debugging is constrained by problems with the Sun One IDE. I've examined
the servlet code. It looks like it has correctly inserted the try ...
finally statements. I can't see why it would miss the Tomcat/DB exception.

Thanks in advance for any suggestions.

<c:catch var="exception">
<sql:setDataSource var="productDS"
url="jdbc:odbc:agdb"
driver="sun.jdbc.odbc.JdbcOdbcDriver"
user="Admin"
password= "${password}"
scope="session"
/>
</c:catch>

<c:if test="${exception != null}">
Sorry. Processing could not be performed because...
</c:if>


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


Re: Help with catch tag

Posted by Felipe Leme <t5...@sneakemail.com>.
On Sunday 27 July 2003 01:11 pm, Mike Steigerwald Steiger-at-UMich.edu 
|jakarta| wrote:
> I guess I need a code review. Can anyone see what might be wrong with the
> snippet below? It does not seem to catch an exception generated when the

Ok, I'll try...

> <c:if test="${exception != null}">
> Sorry. Processing could not be performed because...
> </c:if>

I guess null is not a valid EL literal. Try this:

<c:if test="${not empty exception}">
Sorry. Processing could not be performed because...
</c:if>


Felipe

 

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