DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

JSP: Printing Java Stacktraces In JSP Pages

06.18.2008
| 6785 views |
  • submit to reddit
        // 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))
}