[問題] 請教網頁的會員登入問題

看板Web_Design作者 (勇氣!)時間19年前 (2006/08/16 01:44), 編輯推噓0(005)
留言5則, 3人參與, 最新討論串1/1
想請教一下我寫的網頁會員登入網頁 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>&nbsp;</p> <p align="center"><strong><font color="#333366">Input ID &amp; Password</font></strong></p> <table border="0" align="center" bgcolor="#DDEBEC"> <tr> <td rowspan="5" bgcolor="#9999FF">&nbsp;</td> <td rowspan="5" bgcolor="#FFFFFF">&nbsp;</td> <td> <div align="center"> <p><font color="#333366">‧請輸入您的<u>帳號</u>和<u>密碼</u>以便進 入會員註冊系統</font></p> </div></td> <td rowspan="5" bgcolor="#FFFFFF">&nbsp;</td> <td rowspan="5" bgcolor="#9999FF">&nbsp;</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">&nbsp; </p> </form> <body> <p>&nbsp;</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
我只能說,這根本沒有 JavaScript 阿...
08/16 02:00, 1F
※ 編輯: postino09 來自: 61.62.158.73 (08/16 02:24)

08/16 02:44, , 2F
要轉去Java版嗎?
08/16 02:44, 2F

08/16 02:45, , 3F
其實也不用轉po了, 錯誤處理的是'loginerror.jsp'
08/16 02:45, 3F

08/16 02:48, , 4F
可是指定的errorPage是'errorlogin.jsp' ...
08/16 02:48, 4F
※ 編輯: postino09 來自: 61.62.158.73 (08/16 02:50)

08/16 02:50, , 5F
SORRY 我打錯了 以改正 謝謝!
08/16 02:50, 5F
※ 編輯: postino09 來自: 61.62.158.73 (08/16 02:56)
文章代碼(AID): #14uWW1An (Web_Design)