I have set my error page like this in web.xml:
<error-page> <exception-type>java.lang.Exception</exception-type> <location>/errors/error.jsp</location> </error-page>
Now I would like to print stack trace of error on JSP (of course in development mode only). How can I print stack trace of error on my JSP page? I don't use any frameworks for this application, so only default servlet APIs are available for my program.
get the parameter from request that is set internally and use it to print and deal with other information like cause
, message
<c:set var="exception" value="${requestScope['javax.servlet.error.exception']}"/>
and to print stacktrace
<!-- Stack trace --> <jsp:scriptlet> exception.printStackTrace(new java.io.PrintWriter(out)); </jsp:scriptlet>
See Also
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With