第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

為什么我的一直都是進(jìn)入登錄失敗界面

我根據(jù)老師教的寫的代碼 但是不管輸入的帳號密碼是不是admin 都是進(jìn)入登錄失敗的頁面 ?可否幫看看那里錯了

//login.jsp

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" %>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

? <head>

? ? <base href="<%=basePath%>">

? ??

? ? <title>My JSP 'index.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0"> ? ?

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="This is my page">

<!--

<link rel="stylesheet" type="text/css" href="styles.css">

-->

? </head>

??

? <body>

? ?<big><strong><a>用戶登錄</a></strong></big><hr>

? ?<form action="dologin.jsp" method="post">

? ?<table>

? ?<tr>

? ?<td>用戶名</td>

? ? <td><input type="text" name="usename"/></td>

? ?</tr>

? ?<tr>

? ?<td>密碼</td>

? ? <td><input type="password" name="password"/></td>

? ?</tr>

? ?<tr>

? ?<td colspan="2"><input type="submit" value="登錄"/></td>

? ?</tr>

? ?</table>

? ?</form>

? </body>

</html>

//dologin.jsp

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" %>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String usename="";

String password="";

request.setCharacterEncoding("utf-8");//防止中文亂碼

usename=request.getParameter("usename");

password=request.getParameter("password");

//如果用戶名和密碼都是admin則登錄成功否則失敗

if("admin".equals(usename)&&"admin".equals(password))

{ ??

? ? ?session.setAttribute("loginuesname",usename );

? ? ?request.getRequestDispatcher("login_success.jsp").forward(request, response);

? ??

? ? ?}

? ? ?else

? ? ?{

? ? ?response.sendRedirect("login_failure.jsp");

? ? ?}


%>

//login_success.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

? <head>

? ? <base href="<%=basePath%>">

? ??

? ? <title>My JSP 'login_success.jsp' starting page</title>

? ??

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0"> ? ?

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="This is my page">

<!--

<link rel="stylesheet" type="text/css" href="styles.css">

-->


? </head>

??

? <body>

? <%

? ? String loginusename="";

? ? if(session.getAttribute("loginusename")!=null)

? ? {

? ? ? ?loginusename=session.getAttribute("loginusename").toString();

? ? ? ?}

? ?%>

? ?歡迎您<font color="red"><%=loginusename%></font>登錄成功.

? </body>

</html>

//login_failure.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

? <head>

? ? <base href="<%=basePath%>">

? ??

? ? <title>My JSP 'login_failure.jsp' starting page</title>

? ??

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0"> ? ?

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="This is my page">

<!--

<link rel="stylesheet" type="text/css" href="styles.css">

-->


? </head>

??

? <body>

? ? <strong>登錄失敗,請返回重新登錄!</strong><br>

? ? <strong><a href="login.jsp">返回登錄</a></strong>

? </body>

</html>


正在回答

2 回答

自己不細(xì)心??磮D

5858eeaa0001c47205000190.jpg

5858eeaa0001d24a05000347.jpg


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_森旅迷了鹿_0

你設(shè)置的是loginuesname,那么判斷是否為空的時(shí)候是調(diào)用你設(shè)置的那個(gè)loginuesname。你所定義的loginusename只負(fù)責(zé)接收你判斷不為空的值。
2016-12-20 回復(fù) 有任何疑惑可以回復(fù)我~
#2

龍鳴星星 提問者 回復(fù) qq_森旅迷了鹿_0

好的謝謝
2016-12-20 回復(fù) 有任何疑惑可以回復(fù)我~
#3

龍鳴星星 提問者

非常謝謝
2016-12-20 回復(fù) 有任何疑惑可以回復(fù)我~
#4

qq_森旅迷了鹿_0 回復(fù) 龍鳴星星 提問者

不用謝,記得給最佳哦。
2016-12-21 回復(fù) 有任何疑惑可以回復(fù)我~
查看1條回復(fù)

什么錯誤?


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

龍鳴星星 提問者

沒錯誤 就是在登錄界面 不管密碼和帳號是什么都是進(jìn)入我設(shè)置的錯誤界面
2016-12-19 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么我的一直都是進(jìn)入登錄失敗界面

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號