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

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

為什么跳轉(zhuǎn)不到login_success.jsp頁(yè)面?

<%

String path = request.getContextPath();

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

String username="";

String password="";

request.setCharacterEncoding("UTF-8");

username=request.getParameter("username");

password=request.getParameter("password");

//如果用戶名和密碼都等于admin,則登錄成功;

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

{

? session.setAttribute("loginUser",username);

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

}else{

? response.sendRedirect("login_failure.jsp");//如果登錄名或密碼錯(cuò)誤,則登錄失?。?/p>

}

%>


正在回答

2 回答

login.jsp頁(yè)面的代碼:

<%@ 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>imooc-login</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>

? ?<div id="container">

? ? ? <div class="logo">

? ? ? ? ?<a href="dologin.jsp"><img src="assets/006.jpg" alt="" /></a>

? ? ? </div>

? ? ? <div id="box">

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

? ? ? ? ?<p class="main">

? ? ? ? ? ? ?<label>用戶名:</label>

? ? ? ? ? ? ?<input name="username" value="" />

? ? ? ? ? ? ?<label>密碼:</label>

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

? ? ? ? ?</p>

? ? ? ? ?<p class="space">

? ? ? ? ? ? <input type="submit" value="登錄" class="login" style=""/>

? ? ? ? ?</p>

? ? ? ? ?</form>

? ? ? </div>

? ?</div>

? </body>

</html>

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 '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>

? ?<div id="container">

? ? ? <div class="logo">

? ? ? ? ?<a href="dologin.jsp"><img src="assets/006.jpg" alt="" /></a>

? ? ? </div>

? ? ? <div id="box">

? ? ? <%

? ? ? ? ?String loginUser="";

? ? ? ? ?if(session.getAttribute("loginUser")!=null){

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

? ? ? ? ?}??

? ? ? ?%>

? ? ? ? ?歡迎您<font color="red"><%=loginUser%></font>,登陸成功!

? ? ? </div>

? ?</div>

? </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 '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>

? ?<div id="container">

? ? ? <div class="logo">

? ? ? ? ?<img src="assets/006.jpg" alt="" />

? ? ? </div>

? ? ? <div id="box">

? ? ? ? ?登陸失?。≌?qǐng)檢查用戶名或密碼!<br/>

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

? ? ? </div>

? ?</div>

? </body>

</html>

這些就是所有頁(yè)面的代碼了


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

扶月

你跳轉(zhuǎn)的頁(yè)面是login.jsp而你做的跳轉(zhuǎn)頁(yè)面是login_success.jsp所以不可能對(duì)
2019-02-08 回復(fù) 有任何疑惑可以回復(fù)我~
#2

扶月

dologin.jsp少寫(xiě)個(gè)do
2019-02-08 回復(fù) 有任何疑惑可以回復(fù)我~

你最好吧別的頁(yè)面的代碼,也發(fā)上來(lái)。

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

老子尼克楊 提問(wèn)者

已經(jīng)發(fā)了,可以幫我看一下嗎?謝謝
2018-12-11 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么跳轉(zhuǎn)不到login_success.jsp頁(yè)面?

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

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

幫助反饋 APP下載

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

公眾號(hào)

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