<%@ page contentType="text/html; charset=GBK" isErrorPage="true" %>
<html><body bgcolor="#ffffff">
抱歉,系統發生異常,點擊 <a href="login.jsp">這兒</a> 返回首頁
</body></html>
關鍵:isErrorPage="true" 才能存取 exception 隱含物件。
在功能性 JSP 頁面加入:<%@ page errorPage="error.jsp" %>。
switch.jsp、login.jsp 皆指向 error.jsp。login.jsp 另有 error_error.jsp 遞迴防護(略)。<%@ page contentType="text/html; charset=GBK" errorPage="error.jsp" %>
<html><body bgcolor="#ffffff">
密碼不正確,點擊 <a href="login.jsp">這兒</a> 重新登入
</body></html>
switch.jsp 驗證失敗時 response.sendRedirect("fail.jsp") 或 forward 導向此頁。

