吴裕雄--天生自然JAVA开发JSP-Servlet学习笔记:exception对象-JSP脚本的异常机制

<%-- 
    Document   : throwEx
    Created on : 2020-4-11, 22:04:20
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" errorPage="error.jsp"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title> JSP脚本的异常机制 </title>
    </head>
    <body>
        <%
            int a = 6;
            int c = a / 0;
        %>
    </body>
</html>
<%-- 
    Document   : error
    Created on : 2020-4-11, 22:07:16
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" isErrorPage="true"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title> 异常处理页面 </title>
    </head>
    <body>
        异常类型是:<%=exception.getClass()%><br/>
        异常信息是:<%=exception.getMessage()%><br/>
    </body>
</html>

猜你喜欢

转载自www.cnblogs.com/tszr/p/12682603.html
今日推荐