亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

運行以后登錄界面出現了這個

http://img1.sycdn.imooc.com//578c500d0001ee1702890187.jpg沒有輸入任何東西,編完代碼后登錄網頁用戶名和密碼就出現了這個。

login.jsp代碼:

?<body>

? <%

? ? 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();

? ? }

? ? }

? ? }

? %>

? ?<h1>用戶登錄</h1>

? ?<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" name="password" value=<%=password%>/></td>

? ? ? ?</tr>

? ? ? ?<tr>

? ? ? ? ?<td colspan="2"><input type="checkbox" name="isUseCookies" checked="checked"/>十天內記住我的登錄狀態</td></tr>

? ? ? ?<tr>

? ? ? ? ?<td colspan="2" align="center" ><input type="submit" value="登錄"/><input type="reset" value="取消"/></td></tr>

? ? ?</table>

? ? </form>

? </body>


正在回答

3 回答

name="username" value="<%=username %>"

0 回復 有任何疑惑可以回復我~

?<td><input type="text" name="username" value=<%=username%>/></td>

? ? ? ?</tr>

? ? ? ?<tr>

? ? ? ? ?<td>密碼:</td>

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

? ? ? ?</tr>

input標簽的value屬性的屬性值需要引號括起來,注意是value="屬性值"

0 回復 有任何疑惑可以回復我~

你取消勾選十天內記錄登陸狀態登陸,然后再回到這個頁面上試試看還在不在

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

運行以后登錄界面出現了這個

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號