Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unified error handlig

Anthony Lopez
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am redirecting error handlig to a servle via a jsp:forward action simply using the declarative context in the application's web.xml:
Now, the thing is that, as specified in the servlets 2.3 DTD, the servlet you are redirecting to has to be part of the same Web app context:
. . .
<!ELEMENT error-page ((error-code | exception-type), location)>
The error-page element contains a mapping between an error code or exception type to the path of a resource in the web application
<!ELEMENT error-code (#PCDATA)>
The error-code contains an HTTP error code, ex: 404
<!ELEMENT exception-type (#PCDATA)>
The exception type contains a fully qualified class name of a Java exception type.
<!ELEMENT location (#PCDATA)>
The location element contains the location of the resource in the web application
. . .
So I think you must have a redirecting JSP to a servlet, both in the same web application, possibly using general helper classes in <>/ROOT/classes
also there is no hierarchical handling here. If the Web app context does not handle the error it is not redirected to the ROOT's web.xml.
I am trying to avoid having a forwarding JSP and a servlet for each web context.
Have you found a hack aroung this?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!