JSP: Printing Java stacktraces in JSP pages
1 2 3 try{ 4 //some code that throws an exception 5 } 6 catch(Exception e){ 7 // Cannot print using standard out. Cast JSP writer into a print writer. 8 e.printStackTrace( new java.io.PrintWriter(out)) 9 } 10