JSP Error Page usage
Hi all.
I have a JSP error page. When the exception occurs in one of our JSPs, it gets redirected to the error page us usual.
I want to get hold the name of the page the error occured in. If I get request.getHeader("referer") it gives me the name of the page before that, but not actually the one where the error occured.
Any ideas please?
[364 byte] By [
_NBee_a] at [2007-11-27 6:02:12]

# 1
the error will contain the "stacktrace", this stacktrace will tell you which servlet or JSP was the root cause of the error.
The error page is reached through a forward, not a redirect, so if you want to get the page that caused the error you need to fetch the current page name using one of the HttpServletRequest methods, not by fetching the referrer.
# 4
Having said that, I found that it doesn't work on an old version of Tomcat, 4.0.6. Probably because it supports the old JSP/Servlet specification.Any ideas what that key would be for the old version?
# 5
I don't have Tomcat 4 running here, but I can tell you that you can get all attribute names using request.getAttributeNames().
Enumeration attributeNames = request.getAttributeNames();
while (attributeNames.hasMoreElements()) {
String attributeName = (String) attributeNames.nextElement();
System.out.println(attributeName + " = " + request.getAttribute(attributeName));
}
might help in debugging.