为啥我创建的Cookie老是有问题
<%@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>_