<%@ page language="java" contentType="text/html; charset=UTF-8"
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>Insert title here</title>
</head>
<body>
<%--
Cookie方法:
setMaxAge(int)/getMaxAge();//返回Cookie过期之前的最大时间,秒计算int
setName/getName();/setValue/getValue();//返回cookie名字/值
eg:
//获取当前站点的所有cookie
Cookie[] cookies=request.getCookies();
Cookie namecookie=new Cookie("username","beauby");
Cookie pwd=new Cookie("pwd","123");
response.addCookie(namecookie);
response.addCookie(pwd);
cookie不设时间就随浏览器关闭而消失
namecookie.setMaxAge(60*60);
for(int i=0;i<cookies.length;i++){
out.println(cookies[i].getName()+"--"+cookies[i].getValue())
}
--%>
<form action="g.jsp" name="loginForm">
<input type="text" name="name">
<input type="submit">
</form>
</body>
</html>