Hi,
 As suggeseted I switched to JSTL 1.0
I'm running my application using Tomcat 4.1.30.

Below is the content of my error page.

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>
<%@ page language ="java"
    import="java.util.*,javax.servlet.http.*"
    isErrorPage="true" %>

<table cellSpacing="0" cellPadding="0" width="90%" align="center">
 <tr>
  <td align="middle" class="msg" valign="center" width="50%">
   <c:choose>
   <c:when test="${exception.class.name == 
'com.structs.InvalidParameterException'}">
     Exception is InvalidParameterException.
   </c:when>
   <c:otherwise>
     Exception is not InvalidParameterException.
   </c:otherwise>
  </c:choose>
  </td>
 </tr>
</table>

If I'm not wrong 'exception' is an implicit object available to a JSP.
But I never see the when part of content getting printed even if 
InvalidParameterException
is thrown.

I also tried <c:when test="${exception.getClass().getName() == 
'com.structs.InvalidParameterException'}">
But this time it encountered some parsing error.

How exactly an object instance is passed to a JSTL tag? I'm not very clear on 
that.
Let me know where I'm doing wrong.

Regards,
Ashutosh


-----Original Message-----
From: Joe Germuska [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 23, 2005 4:51 PM
To: Karsten Krieg; Struts Users Mailing List
Subject: Re: Antwort: Clarrifications on Usage of logic tag library


At 11:40 AM +0100 2/23/05, Karsten Krieg wrote:
>Hi!
>
>It's been suggested to not continue using the Struts own tag libraries and
>instead move on to the JSTL. With them, I'd construct the following for
>your scenario:

while this is a good general suggestion, neither tag library makes it 
easy to deal with the class of an exception.  I suppose technically 
you could use bean properties to test against the string form of an 
exceptions' class name:
<c:if test="${ex.class.name == 'java.lang.IllegalStateException'}">..</c:if>

but you might simply find Struts' own declarative exception handling 
to be a more straightforward way to deal with this...

Joe


><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>
>
><c:choose>
>       <c:when test="${exception1}">
>             your content
>       </c:when>
>       <c:when test="${exception2}">
>             your content
>       </c:when>
></c:choose>
>
>You can nest the c:when and c:choose, so AND and OR constructs are
>possible.
>
>With regards
>Karsten Krieg
>intarsys consulting GmbH
>----------------------------------------
>Fon +49 (0)721 3 84 79 - 28
>Fax +49 (0)721 3 84 79 - 60
>e-mail [EMAIL PROTECTED]
>http://www.intarsys.de
>----------------------------------------
>
>"Ashutosh Satyam" <[EMAIL PROTECTED]> schrieb am 23.02.2005 11:19:48:
>
>>  Hi,
>>   Can you suggest how to use the logic tag library to achieve the
>>  following scenario.
>>
>>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>
>>   In my Action class I expect few Exceptions to be thrown. Incase if
>>  any exception
>>   is throw it's always redirected to a common 'error.jsp' page.
>>
>>   In this page I wanted to use 'logic' taglibrary to present a
>>  different content in the
>>   page based on the Exception thrown.
>>
>>   Something like -
>>    if( Exception1) {
>>      some html contents
>>  } else if(Exception2) {
>>      some html contents
>>  } else {
>>     some html contents
>>  }
>>
>>  Also how do we achieve logical AND and logical OR condtion using
>>  logic tag library
>>
>>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>
>>   I hope we can use the logic taglibrary in the scenario what I
>>  pointed out. An example
>>   for the same would suffice my requirement.
>>
>>  Regards,
>>  Ashutosh
>>
>>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


-- 
Joe Germuska            
[EMAIL PROTECTED]  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to