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.

解决方案 »

  1.   

    简单的说就是在错误页面里面加上<%@   page   isErrorPage= "true "   %> 反倒不能运行了。没有这个倒是一切正常的导航。我用的是netbeans 5.5.1。
      

  2.   

    每 JSP 页中仅能使用一次 page 指令特性。
    所以你还是把那些属性都写到一个page 指令中去。
    <%@page   contentType= "text/html " ; pageEncoding= "UTF-8 "  %>这样。
      

  3.   

    感觉 isErrorPage属性没什么问题。
    <html>
            <h1> Error </h1>
            <%-- <%=exception%> --%>
            </body>
    </html> 
    以上没有 <body>  , 红色部分没看懂。
      

  4.   

    奥,可能我粘贴的有问题,body那个不影响。<%=exception%>是输出错误页面的错误信息,只有设置isErrorPage=   "true   "的页面才能用exception内置对象,它接受服务器导航其他页面产生的错误。我的问题是我设置了isErrorPage=   "true   "竟然出现500错误不解,错误页面应该是捕获这个错误的啊,何况没有那一行反倒能运行
      

  5.   

    这样的页面有没有上面那个<body>标签都是能运行的 而且页面也没错 你把tomcat里work文件夹清空下运行看看