getException()
返回值:當前頁面的 exception 異常物件。<%@page language="java" errorPage="error.jsp" pageEncoding="GBK"%> <% Integer.parseInt("d"); %>編寫 error.jsp 頁面,關鍵程式碼如下:
<%@page language="java" pageEncoding="GBK" isErrorPage="true"%> <% Exception e = pageContext.getException(); out.print(e.getMessage()); %>