This may answer your question.
From Chapter 9 of
JavaServer Pages, 2nd Edition, by Hans Bergsten, OReilly Publishing. In the quote, "this approach" refers to the use of an error page declaration in the deployment descriptor (i.e. web.xml).
Due to an unfortunate naming mismatch between the servlet and JSP specification, there's one problem with this approach if you use a JSP page to handle the exception: the exception property of the implicit pageContext variable isn't initialized so you can't log or display the exception message as in Example 9-12. I show how you can use a servlet to work around this problem in Chapter 18.
In example 9-12 that he references in the quote, the author uses the <c:out> in a fashion similiar to you:
<c:out value="${pageContext.exception.message}" />
(Note the 2nd Edition of this book is based mostly on the
Servlet 2.3/JSP 1.2 specification).
If you add a <%@ page errorPage="SystemErrorDisplay.jsp" @> to the page you are using to cause the error/exception,
you should get the desired results. Of course the down side of using the errorPage attribute is that all types of errors/exceptions are handled via the same error page. You therefore lose the advantage of having a different page based on the type of error (one page for 404 errors, another for General Exceptions, etc). So you will need to work around the issue if you want to use the exception/error mappings in your deployment descriptor.
In chapter 18 of his book, Mr. Bergsten goes on to say:
There's one problem, though: if you use a JSP page to handle the exception, you can't log or display the exception message, because a JSP page invoked this way doesn't have access to the exception through the type of EL expression used in the error page in Chapter 9. The reason is a request-attribute name mismatch between the servlet and JSP specification. The servlet specification defines the name javax.servlet.error.exception for the request attribute holding the Throwable object that represents the exception, while the JSP specification defines the name javax.servlet.jsp.jspException. Hopefully this will be synced in future versions of the specifications, but for now you can work around the problem using a servlet to set the attribute the JSP specification requires.
He then goes on to give an example of creating a Servlet to set the attribute correctly. I do not believe it would be within fair use of copyright laws for me to publish that solution here since it goes beyond just a mere quote at that point. So you may want to look at the book yourself to get the solution (it is avaialbe online via
safaribooksonline.com). Or give it some thought and engineer your own solution.
Again, this is from an edition of the book that deals with the 2.3/1.2 specification. The issue may have been fixed in 2.4/2.0, but I so not know, and I have not yet purchased the 3rd edition of his book (since the environment I work in is still a 2.3/1.2 environment) and therefore cannot look to see if he still discusses that as an issue.
[ December 16, 2005: Message edited by: Mark Vedder ]