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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

去掉復(fù)選框,頁面任然記憶賬戶和密碼,后面頁面的查看用戶信息,也不是空 .怎么回事?求救

去掉復(fù)選框,頁面任然記憶賬戶和密碼,后面頁面的查看用戶信息,也不是空 .怎么回事?求救

qq_程康_0 2016-12-27 01:31:07
login.jsp? ? <!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN"> <html> <head> <%@?page?import="java.net.*"?%> <%@?page?language="java"?contentType="text/html;?charset=utf-8" ????pageEncoding="utf-8"%> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"> <title>???????</title> </head> <body> ????<%???request.setCharacterEncoding("utf-8"); ????????String?username=""; ????????String?password=""; ????????Cookie[]?cookie=request.getCookies(); ????????if(cookie!=null&&cookie.length>0){ ????????????for(Cookie?c:cookie){ ????????????????if(c.getName().equals("username")){ ????????????????????username=URLDecoder.decode(c.getValue(),"utf-8"); ????????????????} ????????????????if(c.getName().equals("password")){ ????????????????????password=URLDecoder.decode(c.getValue(),"utf-8"); ????????????????} ????????????} ????????} ????%> ???<form?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"?name="password"?value="<%=password?%>"/></td> ?????????</tr> ?????????<tr> ???????????<td?colspan="2"><input?type="checkbox"?name="ischeckbox"?checked="checked"?value="記住密碼"/>記住密碼</td> ?????????</tr> ??????????<tr> ???????????<td?colspan="2"?align="center"><input?type="submit"?name="submit"?value="登錄"/></td> ?????????</tr> ??????</table> ???</form> ? <html> <head> ? ? ? <!--dologin.jsp---> ? ? <!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN"> <%@?page?import="java.net.*"?%> <%@?page?language="java"?contentType="text/html;?charset=utf-8" ????pageEncoding="utf-8"%> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"> <title>???????</title> </head> <body> ????? ????<%?request.setCharacterEncoding("utf-8"); ????//判斷復(fù)選框是否被選中 ????String[]?checkbox=request.getParameterValues("ischeckbox"); ????if(checkbox!=null&&checkbox.length>0){ ????????String?username=URLEncoder.encode(request.getParameter("username"),"utf-8"); ????????String?password=URLEncoder.encode(request.getParameter("password"),"utf-8"); ????????? ????????//獲得Cookie對象并將信息存入cookie對象 ????????Cookie?usernameCookie=new?Cookie("username",username); ????????Cookie?passwordCookie=new?Cookie("password",password); ????????//保存cookie對象 ????????response.addCookie(usernameCookie); ????????response.addCookie(passwordCookie); ????????usernameCookie.setMaxAge(864000);//生存期限10天 ????????passwordCookie.setMaxAge(864000); ????????? ????} ????else{ ????????Cookie[]?cookie=request.getCookies();//獲得之前保存過的Cookie對象 ????????if(cookie!=null&&cookie.length>0){ ????????????for(Cookie?c:cookie){ ????????????????if(c.getName().equals("username")||c.getName().equals("password")){ ????????????????c.setMaxAge(0);//銷毀對象 ????????????????response.addCookie(c); ????????????????}?? ????????????} ????????} ????????? ????} ????%> ????<a?href="testlogin.jsp"?>查看用戶信息</a>?? </body> </html> ? ? ? testlogin.jsp ? <!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN"> <%@page?import="java.net.URLDecoder"%> <html> <head> <%@?page?language="java"?contentType="text/html;?charset=utf-8" ????pageEncoding="utf-8"%> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"> <title>???????</title> </head> <body> ????<h1>用戶信息</h1> ????<hr> ????<% ????request.setCharacterEncoding("utf-8"); ????String?username=""; ????String?password=""; ????Cookie[]?cookie=request.getCookies();//獲取Cookie對象 ????if(cookie!=null&&cookie.length>0){ ????????for(Cookie?c:cookie){ ????????????if(c.getName().equals("username")){ ????????????????username=URLDecoder.decode(c.getValue(),"utf-8"); ????????????????? ????????????} ????????????if(c.getName().equals("password")){ ????????????????password=URLDecoder.decode(c.getValue(),"utf-8"); ????????????} ????????} ????} ????? ????%> ????用戶名:<%=username?%><br> ????密碼:<%=password?%><br> ????? </body> </html>
查看完整描述

1 回答

?
一毛錢

TA貢獻(xiàn)156條經(jīng)驗(yàn) 獲得超57個贊

去掉復(fù)選框,頁面任然記憶賬戶和密碼

這個問題可能是瀏覽器的記憶功能造成的,你去掉復(fù)選框的時候可以清理一下緩存

至于后面的查看詳情不為空,也可能是緩存造成的,你可以在<a?href="testlogin.jsp?t=時間戳"?>查看用戶信息</a> ?

查看完整回答
反對 回復(fù) 2016-12-27
  • 1 回答
  • 0 關(guān)注
  • 1246 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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