JSP errorPage setup method
- 2020-05-24 05:58:20
- OfStack
1. Set errorPage: errorPage.jsp
Application 2.
<%@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>
Application 2.
<%@page info="Bad page"%>
<%@page errorPage="errorPage.jsp" %> // If you make a mistake, switch to
<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>