Not a jsp/maven/java dev myself, i’m trying to configure error pages in a generic way, for a webapp, without touching jboss’s configuration.
Here’s how i’m trying to do so:
in my web.xml, i’ve set up
<error-page>
<error-code>*</error-code>
<location>/actions/erreur</location>
</error-page>
Here, I doubt using ‘*’ works, but that’s for the example.
Then, in my strut-config.xml
<action path="/erreur" forward="erreurView" />
And finally in my tiles-def.xml:
<!-- ERREURS -->
<definition name="erreurView" extends=".formPremiereConnexionLayout">
<put name="titrePage" value="Erreur"/>
<put name="body" value="/jsp/erreurs.jsp"/>
</definition>
You get the idea, if you have an appropriate answer, thanks for the help.
One last thing : even though any server error code send to a generic error view, i’d like to detail the error in the jsp. I think a scriptlet would do fine, buyt once again, I have no idea on how to do so.
Thanks.
The wildcard wouldn’t work. How verbose, you really need to define the status codes of interest separately. E.g.
The last one listens on all exceptions/errors the server could throw. However you can’t be sure if it will ever be displayed on a
java.lang.Error.Inside the error page you can get the important details from the request scope and headers like so:
If you want to print the stacktrace as well, you’ll have to prepare this inside a servlet/beanclass by writing it to a
Stringand putting it in the request scope and finally display it in a<pre></pre>.