運(yùn)行以后登錄界面出現(xiàn)了這個(gè)
沒(méi)有輸入任何東西,編完代碼后登錄網(wǎng)頁(yè)用戶(hù)名和密碼就出現(xiàn)了這個(gè)。
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>用戶(hù)登錄</h1>
? ?<form name="loginForm" action="dologin.jsp" method="post">
? ? ?<table>
? ? ? ?<tr>
? ? ? ? ?<td>用戶(hù)名:</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"/>十天內(nèi)記住我的登錄狀態(tài)</td></tr>
? ? ? ?<tr>
? ? ? ? ?<td colspan="2" align="center" ><input type="submit" value="登錄"/><input type="reset" value="取消"/></td></tr>
? ? ?</table>
? ? </form>
? </body>
2016-10-16
name="username" value="<%=username %>"
2016-07-27
?<td><input type="text" name="username" value=<%=username%>/></td>
? ? ? ?</tr>
? ? ? ?<tr>
? ? ? ? ?<td>密碼:</td>
? ? ? ? ?<td><input type="password" name="password" value=<%=password%>/></td>
? ? ? ?</tr>
input標(biāo)簽的value屬性的屬性值需要引號(hào)括起來(lái),注意是value="屬性值"
2016-07-18
你取消勾選十天內(nèi)記錄登陸狀態(tài)登陸,然后再回到這個(gè)頁(yè)面上試試看還在不在