<title>buy 登录</title>
</head>
<body>
<h1>welcome</h1><br/>
<% String useName=""; String password="";
Genenal.GetCookieUsePassword(request,useName,password);%>
<form action="toLogin?login" method="post">
你的账号名:<input type="text" name="useName" value=<%=useName %>/><br/>
你的密码:<input type="password" name="password" value=<%=password %>/><br/>
<input type="submit" value="登录"/>
</form>
</body>
</html>
public static void GetCookieUsePassword(HttpServletRequest request,String useName,String password){
Cookie[] cookie=request.getCookies();
for(int i=0;i<cookie.length;++i){
if(cookie[i].getName().equals("useName"))
useName=cookie[i].getValue();
if(cookie[i].getName().equals("password"))
password=cookie[i].getValue();
}
}第一次登录时候
</head>
<body>
<h1>welcome</h1><br/>
<% String useName=""; String password="";
Genenal.GetCookieUsePassword(request,useName,password);%>
<form action="toLogin?login" method="post">
你的账号名:<input type="text" name="useName" value=<%=useName %>/><br/>
你的密码:<input type="password" name="password" value=<%=password %>/><br/>
<input type="submit" value="登录"/>
</form>
</body>
</html>
public static void GetCookieUsePassword(HttpServletRequest request,String useName,String password){
Cookie[] cookie=request.getCookies();
for(int i=0;i<cookie.length;++i){
if(cookie[i].getName().equals("useName"))
useName=cookie[i].getValue();
if(cookie[i].getName().equals("password"))
password=cookie[i].getValue();
}
}第一次登录时候
解决方案 »
- <a href="logout">退出登录</a>为什么没能执行action里的方法呢?
- 【100分求助大神】Java调用Soap协议接口,发送xml报文
- jxl操作Excel2003
- 一个基本问题,请各位大侠赐教
- pub.client.ftp:mget服务下载中文名文件发生异常问题
- 100分征求怎样把jre,tomcat,mysql打包办法?
- 奇怪的hibernate生成cfg.xml问题
- Tomcat5配制问题:我想http://localhost/就直接显示我编写的页面。请问怎么配制?
- 『出错』log4j的问题
- 一个简单问题!如果100分少了再加。
- js循环输出set里的对象
- 参数的理解
改成
:<input type="text" name="useName" value=<%=useName %>
后面多东西了 大哥!!!
你的账号名:<input type="text" name="useName"/><br/>
你的密码:<input type="password" name="password"/><br/>
<input type="submit" value="登录"/>
</form>你的value给了值了,肯定会有东西啊,这样写就ok的
你的密码:<input type="password" name="password" value=<%=password %>/><br/>
>/>这应很容易看出来吧。
程序将红色的全部当成value的值了
你的密码:<input type="password" name="password" value="<%=password %>" /><br/>