[問題] 請教網頁的會員登入問題
想請教一下我寫的網頁會員登入網頁
login.jsp 是我的code
若輸入錯誤的使用者或是密碼 會指向errorlogin.jsp
但是我跑出來的結果
輸入正確時 出來的結果是OK的
但輸入錯誤的時候 跑出來的是錯誤的網頁(找不到網頁)
並不會指向errorlogin.jsp
請是出現什麼問題嗎...?
不好意思 我是新手...麻煩各位指正 感激不盡!
*****login.jsp*****
<%@ page contentType="text/html; charset=big5" %>
<%@ page errorPage="errorlogin.jsp"%>
<html>
<head>
<title>會員註冊系統</title>
</head>
<form name="form1" method="post" action="login.jsp">
<p> </p>
<p align="center"><strong><font color="#333366">Input ID &
Password</font></strong></p>
<table border="0" align="center" bgcolor="#DDEBEC">
<tr>
<td rowspan="5" bgcolor="#9999FF"> </td>
<td rowspan="5" bgcolor="#FFFFFF"> </td>
<td>
<div align="center">
<p><font color="#333366">‧請輸入您的<u>帳號</u>和<u>密碼</u>以便進
入會員註冊系統</font></p>
</div></td>
<td rowspan="5" bgcolor="#FFFFFF"> </td>
<td rowspan="5" bgcolor="#9999FF"> </td>
</tr>
<tr>
<td><div align="center"><font color="#333366">帳號:
<input name="id" type="text" id="id" size="8" maxlength="6">
</font></div></td>
</tr>
<tr>
<td><div align="center"><font color="#333366">密碼:
<input name="pwd" type="password" id="pwd" size="8" maxlength="6">
</font></div></td>
</tr>
<tr>
<td><div align="center"> </div></td>
</tr>
<tr>
<td><div align="center">
<input name="Submit" type="submit" value="確定送出">
<input type="reset" name="Submit2" value="重新填寫">
</div></td>
</tr>
</table>
<p align="center"> </p>
</form>
<body>
<p> </p>
<%
request.setCharacterEncoding("big5");
String id;
String pwd;
id = request.getParameter("id");
pwd = request.getParameter("pwd");
if (id.equals("B33946") && pwd.equals("B33946"))
{
out.println("<center>"+"登入成功!"+"</center>");
out.println();
out.println("<a href=./homework.jsp><center>"+"☆會員註冊☆
"+"</center></href>");
}
else
{
throw new Exception("您輸入的帳號或密碼錯誤,請重新輸入!");
}
%>
</body>
</html>
***** errorlogin.jsp *****
<%@ page contentType="text/html; charset=big5" %>
<%@ page isErrorPage="true" %>
<html>
<head>
<title>errorlogin</title>
</head>
<body>
<%
out.println("<center>"+"發生錯誤!"+"</center>");
out.println("<center>"+exception.getMessage()+"</center>");
out.println("<a href=./login.html><center>"+"☆會員登入☆
"+"</center></href>");
%>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.62.158.73
→
08/16 02:00, , 1F
08/16 02:00, 1F
※ 編輯: postino09 來自: 61.62.158.73 (08/16 02:24)
→
08/16 02:44, , 2F
08/16 02:44, 2F
→
08/16 02:45, , 3F
08/16 02:45, 3F
→
08/16 02:48, , 4F
08/16 02:48, 4F
※ 編輯: postino09 來自: 61.62.158.73 (08/16 02:50)
→
08/16 02:50, , 5F
08/16 02:50, 5F
※ 編輯: postino09 來自: 61.62.158.73 (08/16 02:56)