1.设置errorPage:errorPage.jsp
%@page isErrorPage="true"%
html
head
meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
titleJSP Page/title
/head
body
Error~!
%=exception.getMessage()%
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/webkaifa/)/body
/html
2.应用
%@page info="Bad page"%
%@page errorPage="errorPage.jsp" % //出错后转到
html
head
meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
titleJSP Page/title
/head
body
%
boolean tf = true;
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/webkaifa/)if(tf){
String info = getServletInfo();
throw new Exception("Exception in:" + info);
}
%
/body
/html