weblogic 的 web.xml 定义首页及出错页面:
web.xml 部分内容:
- <error-page>
-
<exception-type>java.lang.Exception </exception-type>
-
<location>/error.jsp</location>
-
</error-page>
上面的配置是Exception异常,一遇到任何异常,就会转向error.jsp页面。可以根据具体的情况,配置异常的类型。
Error.jsp:
-
<%@page language="java"
-
contentType="text/html;charset=UTF-8"
-
session="true"
-
isErrorPage="true"
-
%>
-
<%
-
-
if (exception == null) {
-
exception = (Throwable)request.getAttribute("java.lang.Exception");
-
}
-
%>
-
-
<h3>错误信息</h3>
-
-
<pre>
-
<%
-
if (exception != null) {
-
exception.printStackTrace(new java.io.PrintWriter(out));
-
}
-
-
%>
-
</pre>