wood burning stoves 2.0*
The moose likes JSP and the fly likes Implicit variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Implicit variable "exception" is null" Watch "Implicit variable "exception" is null" New topic

Implicit variable "exception" is null

Milena Khlabystova

Joined: Apr 26, 2001
Posts: 9
I am new to jsp/servlets and I came across the following problem (Tomcat 4.1.18 + Apache 2.0 + RedHat 8.0):
I would like all errors & exceptions to go to the following generic error page:
----------- /error-pages/error.jsp ---------
<%@ page isErrorPage="true" %>
Oops! We got an exception:<br>
if (exception != null)
out.print("Just an error");
So, in my web.xml file I added the following entry:
Now, when a servlet throws an exception (in fact, it re-throws any exception thrown inside it, by wrapping it into a ServletException) via
// some code ...
catch(Exception e){
throw new ServletException(e);
the container correctly redirects to error.jsp . The problem is that the implicit variable "exception" that should be available to this page is null. Can anyone tell me why it is so? And is there any way to fix this and access the information about the thrown exception from the error page?
I have seen many postings with a problem similar to mine, but none of them seemed to have any resolutions.
Thanks a lot!
wood burning stoves
subject: Implicit variable "exception" is null
Similar Threads
Question about error pages and JSTL
error in servlet
pageContext.getException() always null
Same exception different handle in tomcat4.1 and weblogic6.1
Page 461