struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GF <>
Subject [S2] getting the Servlet Exception in a custom error page.
Date Thu, 27 Dec 2007 09:56:07 GMT
Hi everyone.
I'm using Struts2, and i'm trying to create a custom error page.

The default Tomcat error page show something like this:

HTTP Status 500
type Exception report
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception javax.servlet.ServletException: java.lang.NullPointerException
... (full stack trace)
root cause java.lang.NullPointerException
... (full stack trace)

I searched on google about creating custom error page.
And I have found to do something like this:

Exception Type: <%=
request.getAttribute("javax.servlet.error.exception_type") %><br />
Error Message: <%= request.getAttribute("javax.servlet.error.message") %><br />
Request URI: <%=
request.getAttribute("javax.servlet.error.request_uri") %><br />

Throwable e = (Throwable) request.getAttribute("javax.servlet.error.exception");

if (e instanceof ServletException) {
// ...
    } else {
// ..
The problem is that I always get the "root cause" and I have not found
any way to get the "ServletException" that has a different stacktrace
from the "root cause".
Is this related to Struts2? Where can i found the ServletException? in
which attribute?

Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message