在web.xml中加上
error.jsp中的body
<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>