Problem Description: Use page jump to prompt the page error message, but the program failed to run, and did not jump to the error page.
The two pieces of code are as follows:
First paragraph (error.jsp):
<!--jump to the error page when an error occurs in this file when an error occurs, it jumps to error.jsp--
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "
pageencoding= "UTF-8" errorpage= "error.jsp"%>
<%
int i = 10/0;//produces an exception
%>
Second paragraph (iserror.jsp):
<!--errorshow_demo.jsp File error when you jump to this page--
<%@ page language= "java" contenttype= "text/html" pageencoding= "Utf-8"%>
<!--means this page can handle errors--
<%@ page iserrorpage= "true"%>
Cause: Tomcat will iserror.jsp also think that an error has occurred, so it cannot be displayed.
Workaround: Add the following code snippet in iserror.jsp:
<%
Response.setstatus (200);//Status code can be selected 200-203
%>
Manually set a status code, indicating that there is no error on this page, can be displayed normally.
JSP error page does not jump to display 500