倚框天外
2014-11-11 14:02
<%@ page language="java" contentType="text/html; charset=utf-8" import="java.net.*" pageEncoding="utf-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <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[] cookies = request.getCookies(); if(cookies!=null && cookies.length>0){ for(Cookie c:cookies){ 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 name="loginForm" action="doLogin.jsp" method="post"> <table> <tr> <td>username</td> <td><input type="text" name="username" value=<%=username%>></input></td> </tr> <tr> <td>password</td> <td><input type="password" name="password" value=<%=password%>></input></td> </tr> <tr> <td> <input type="checkbox" name="isUseCookie" checked="true"/>记住登录状态 </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="submit"/></td> </tr> </table> </form> </body> </html>
<form action="dologin.jsp" name="用户信息登录" method="post">
<table>
<tr>
<td>用户名:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2"><input type="checkbox" name="isUseCookie" checked="checked" />十天内记住我的登录状态</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="登录"><input type="reset" value="取消"></td>
</tr>
</table>
</form>
表单中应该是这些~后面有一个页面有这些东西的答案~其实 你还可以 直接下载 老师的代码。。。
我想了一会儿,猜出了代码,谢谢。。<form name="loginForm" action="dologin.jsp"method="post"/>
<table>
<tr>
<td>用户名:</td>
</tr>
<tr>
<td><input name="username"type="text"value=""/></td>
</tr>
<tr>
<td>密码:</td>
</tr>
<tr>
<td><input name="password"type="password"value=""/></td>
</tr>
<tr>
<td colspan="2"><input type="checkbox"name="isUserCookie" checked="checked">10天内记住我的登录状态</td>
</tr>
<tr>
<td colspan="2"align="center"> <input type="submit"value="登录"/><input type="reset" value="取消"/>
</tr>
</table>
JAVA遇见HTML——JSP篇
248278 学习 · 3071 问题
相似问题