hi, everyone.
I'm testing a project with NetBeans 5.5.1. The web server is Tomcat which binds in the IDE.The first page is:<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page errorPage="errorpage.jsp" %><html>
<body>
<%
int a=10; // double ->>> NaN
int b=0;
a=a/b;
System.out.println("err........................."+a);
%>
<h1>JSP Page</h1>
</body>
</html>
The error page is:<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page isErrorPage="true" %><html>
<h1>Error</h1>
<%--<%=exception%>--%>
</body>
</html>
This is a very normal method to redirect errors to an error page. But I'can run it! If I delete the line <%@ page isErrorPage="true" %>, that's all OK. So is isErrorPage="false".Tell me what's wrong with it.
I'm testing a project with NetBeans 5.5.1. The web server is Tomcat which binds in the IDE.The first page is:<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page errorPage="errorpage.jsp" %><html>
<body>
<%
int a=10; // double ->>> NaN
int b=0;
a=a/b;
System.out.println("err........................."+a);
%>
<h1>JSP Page</h1>
</body>
</html>
The error page is:<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page isErrorPage="true" %><html>
<h1>Error</h1>
<%--<%=exception%>--%>
</body>
</html>
This is a very normal method to redirect errors to an error page. But I'can run it! If I delete the line <%@ page isErrorPage="true" %>, that's all OK. So is isErrorPage="false".Tell me what's wrong with it.
所以你还是把那些属性都写到一个page 指令中去。
<%@page contentType= "text/html " ; pageEncoding= "UTF-8 " %>这样。
<html>
<h1> Error </h1>
<%-- <%=exception%> --%>
</body>
</html>
以上没有 <body> , 红色部分没看懂。