Over a million developers have joined DZone.

JSP: Printing Java Stacktraces In JSP Pages

// This snippet shows how to view java stack traces for exceptions occurring inside jsp files.

  //some code that throws an exception
catch(Exception e){
  // Cannot print using standard out. Cast JSP writer into a print writer.
  e.printStackTrace( new java.io.PrintWriter(out))


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}