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.



try{
  //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))
}

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}