Is it possible to save yourself a lot of work by dynamically pass an exception type (or error code) in web.xml instead of "classic" hardcoding?
For example use something similar to <exception-type>*</exception-type>
instead of <exception-type>SomeException</exception-type>
and then use sth similar to <location>/MyServlet?exctype=$exception-type$</location>
instead of <location>/MyServlet</location>
(or <location>/MyServlet?exctype=SomeException</location>
)?
And/or similarly for <error-code>
?
/* Below isn't correct web.xml syntax and will not work but is a sketch of what I am looking for. */
<error-page>
<exception-type>*</exception-type>
<location>/MyServlet?exctype=$exception-type$</location>
</error-page>
<error-page>
<error-code>*</error-code>
<location>/MyOtherServlet?errcode=$error-code$</location>
</error-page>