qq_吊儿郎当_6
2017-03-29 16:51
<%@page import="java.net.CookieHandler"%>
<%@page import="org.omg.CORBA.RepositoryIdHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<!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>Insert title here</title>
</head>
<body>
<h1>登录成功</h1>
<hr>
<br>
<br>
<br>
<br>
<%
//判断是否选择了记住登录状态
String[] isUserCookie=request.getParamerterValues("isUserCookie");
if( isUserCookie!=null&&isUserCookie.length>0)
{
String username=request.getParmarterValue("username");
String passward=request.getParmarterValue("passward");
Cookie usernamecookie=new Cookie("username",username);
Cookie passwardcookie=new Cookie("passward",passward);
usernamecookie.setMaxage(864000);
passwardcookie.setMaxage(864000);
response.addCookie(usernamecookie);
response.addCookie(passwardcookie);
}
else{
Cookie[] cookie=request.getCookie();
if(cookie!=null&&cookie.length>0)
{
for(Cookie c:cookie)
{
if(c.getName().equals("username")||c.getName()/equals("passward"))
{
c.setMaxage(0);
response.addCookie(c);
}
}
}
}
%>
<a href="users.jsp" target="_Blank">查看已经登录的用户信息</a>
</body>
</html>_
if(c.getName().equals("username")||c.getName()/equals("passward")) 这一行是不小心输错了吧
c.getName()/equals("passward")) 方法调用改为“.”c.getName().equals("passward"))
JAVA遇见HTML——JSP篇
248277 学习 · 3071 问题
相似问题