tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konrad Bernstein" <bern...@gmx.net>
Subject pageContext.getException() always null
Date Mon, 06 Jun 2005 06:41:08 GMT
Hi,
I have a rather strange problem with handling an exception within a custom
jsp tag.

The problem is, that pageContext.getException() always returns null.
This is the case within the tag's code, but also witin a Scriptlet within
the JSP.
However, the variable 'exception' itself is properly set.

My error.jsp looks like this:
<%@page isErrorPage="true" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
   System.out.println("Exception = " + exception);
   System.out.println("exPage = " + pageContext.getException());
%>
   
<HTML>
  <HEAD>
    <title>Error</title>
  </HEAD>
  <body>
   <H1>Error occured</H1>
   <custom:errortag/>
  </body>
</html>


The tag class has code like this:

    private Exception getTerribleException() {
        
        if (pageContext.getException() == null) {
            System.out.println("pageContext has null exception");
            return null;
        }
        ...
    }

Well, the output is as mentioned above: only the variable 'exception' within
the JSP can be successfully accessed. Retrieving the exception from the
pageContext always returns null.

Exception = javax.servlet.ServletException: This is my self thrown
exception.
exPage = null
pageContext has null exception

As far as I know, for all error pages (<%@page isErrorPage="true" %>),
the counterpart for the implicit variable 'exception' of a JSP is
pageContext.getException().

However, something seems to go wrong.
I'm using JBoss 3.2.26 with integrated Tomcat. I also tried tomcat
standalone (5.0.18), same result.

Help greatly appreciated,
Konrad

-- 
Geschenkt: 3 Monate GMX ProMail gratis + 3 Ausgaben stern gratis
++ Jetzt anmelden & testen ++ http://www.gmx.net/de/go/promail ++

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


Mime
View raw message