How can I print error stack trace in JSP page?

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

  • JSPIntro4 – Handling Errors

Leave a Comment