作者:影帝 | 来源:互联网 | 2022-08-20 01:35
1.设置errorPage:errorPage.jsp
代码如下:
<%@page isErrorPage="true"%>
Error~!
<%=exception.getMessage()%>
2.应用
代码如下:
<%@page info="Bad page"%>
<%@page errorPage="errorPage.jsp" %> //出错后转到
<%
boolean tf = true;
if(tf){
String info = getServletInfo();
throw new Exception("Exception in:" + info);
}
%>