高手给看看 cookie
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
<%
Cookie cookie = new Cookie("name", "1");
response.addCookie(cookie);
Cookie cookie1 = new Cookie("pwd", "2");
response.addCookie(cookie1);
Cookie[] cookies = request.getCookies();
out.println(cookies);
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
out.println(cookies[i].getValue() + " "
+ cookies[i].getName());
}
}
%>
</body>
</html>
为什么 第一次加载的是很 没有取到值啊 第二次就能取到了啊
------解决方案--------------------