日期:2014-05-16  浏览次数:20405 次

jsp错误页面打印错误栈
在web.xml中加上
	<error-page>
	<exception-type>java.lang.Exception</exception-type>
		<location>/error.jsp</location>
	</error-page>

error.jsp中的body
<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" bgcolor="#FBFDFF">

     <H1>异常:</H1><span style="color:red"><%= exception.toString()%></span><br>
     <H2>信息:</H2><%= exception.getMessage()%><br>
     <pre>
     <%
         exception.printStackTrace();
     	 ByteArrayOutputStream ostr = new ByteArrayOutputStream();
     	 exception.printStackTrace(new PrintStream(ostr));
     	 out.print(ostr);
     %>
     </pre>
</body>