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

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

為什么沒有顯示用戶名和密碼

//這是dologin.jsp代碼
<%@?page?contentType="text/html;charset=UTF-8"?language="java"?%>
<html>
<head>
????<title></title>
</head>
<body>
<h1>登錄成功</h1>
<hr>
<br/>
<br/>
<br/>
<%
????//首先判斷用戶是否選擇了記住登錄狀態(tài)
????String[]?isUseCookies=request.getParameterValues("isUseCookie");
????if(isUseCookies!=null&&isUseCookies.length>0){
????????//把用戶名和密碼保存在Cookie對象里面
????????String?username=request.getParameter("username");
????????String?password=request.getParameter("password");
????????Cookie?usernameCookie=new?Cookie("username",username);
????????Cookie?passwordCookie=new?Cookie("password",password);
????????usernameCookie.setMaxAge(864000);
????????passwordCookie.setMaxAge(864000);//設(shè)置最大生存期限為10天
????????response.addCookie(usernameCookie);
????????response.addCookie(passwordCookie);
????}else{
????????Cookie[]?cookies=request.getCookies();
????????if(cookies!=null&&cookies.length>0){
????????????for(Cookie?c:cookies){
????????????????if(c.getName().equals("username")||c.getName().equals("password")){
????????????????????c.setMaxAge(0);//設(shè)置Cookies失效
????????????????????response.addCookie(c);//重新保存
????????????????}
????????????}
????????}
????}
%>
<a?href="users.jsp"?target="_blank">查看用戶信息</a>
</body>
</html>
//這是user.jsp代碼
<%@?page?contentType="text/html;charset=UTF-8"?language="java"?%>
<html>
<head>
????<title>Title</title>
</head>
<body>
<h1>用戶信息</h1>
<hr>
<%
????String?username="";
????String?password="";
????Cookie[]?cookies=request.getCookies();
????if(cookies!=null&&cookies.length>0){
????????for(Cookie?c:cookies){
????????????if(c.getName().equals("username")){
????????????????username=c.getValue();
????????????}
????????????if(c.getName().equals("password")){
????????????????password=c.getValue();
????????????}
????????}
????}
%>
<br/>
<br/>
<br/>
用戶名:<%=username%><br/>
密碼:<%=password%><br/>

</body>
</html>
//這是login.jsp代碼
<%@?page?contentType="text/html;charset=UTF-8"?language="java"?%>
<html>
<head>
????<title>Title</title>
</head>
<body>
<h1>用戶信息</h1>
<hr>
<%
????String?username="";
????String?password="";
????Cookie[]?cookies=request.getCookies();
????if(cookies!=null&&cookies.length>0){
????????for(Cookie?c:cookies){
????????????if(c.getName().equals("username")){
????????????????username=c.getValue();
????????????}
????????????if(c.getName().equals("password")){
????????????????password=c.getValue();
????????????}
????????}
????}
%>
<br/>
<br/>
<br/>
用戶名:<%=username%><br/>
密碼:<%=password%><br/>

</body>
</html>


正在回答

3 回答

已經(jīng)解決了,代碼問題,不過用戶名出現(xiàn)了亂碼

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

?我修改了代碼不過只記住了用戶名,? ? ? 密碼沒有顯示出來

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

第三個錯了login.jsp是這個

<%@?page?contentType="text/html;charset=UTF-8"?language="java"?%>
<html>
<head>
????<title>用戶登錄</title>
</head>
<body>
<h1>用戶登錄</h1>
<hr>
<%
????String?username="";
????String?password="";
????Cookie[]?cookies=request.getCookies();
????if(cookies!=null&&cookies.length>0){
????????for(Cookie?c:cookies){
????????????if(c.getName().equals("username")){
????????????????username=c.getValue();
????????????}
????????????if(c.getName().equals("password")){
????????????????password=c.getValue();
????????????}
????????}
????}
%>
<form?name="loginForm"action="dologin.jsp"method="post">
????<table>
????????<tr>
????????????<td>用戶名:</td>
????????????<td><input?type="text"name="username"value="<%=username%>"/></td>
????????</tr>
????????<tr>
????????????<td>密碼:</td>
????????????<td><input?type="password"naem="password"value="<%=password%>"/></td>
????????</tr>
????????<tr>
????????????<td?colspan="2"><input?type="checkbox"name="isUseCookie"checked="checked"/>十天內(nèi)記住我的登錄狀態(tài)</td>
????????</tr>
????????<tr>
????????????<td?colsapn="2"?align="center"><input?type="submit"?value="登錄"/>&#160;&#160;<input?type="reset"?value="取消"/></td>
????????</tr>
????</table>
</form>
</body>
</html>


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

舉報

0/150
提交
取消

為什么沒有顯示用戶名和密碼

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

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

幫助反饋 APP下載

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

公眾號

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