1.设置errorPage:errorPage.jsp
实现代码如下:

<%@page isErrorPage="true"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
Error~!
<%=exception.getMessage()%>
</body>
</html>

2.应用
实现代码如下:

<%@page info="Bad page"%>
<%@page errorPage="errorPage.jsp" %> //出错后转到
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
boolean tf = true;
if(tf){
String info = getServletInfo();
throw new Exception("Exception in:" + info);
}
%>
</body>
</html>

以上就是【JSP errorPage设置方法】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)
发表我的评论

最新评论

  1. 暂无评论