<p>I'm using cookie to store info, and it works in saving and retreiving cookie in the same page, but when i try to retrieve the cookie from another page, i can't get the cookie.
<p>
The code is like this:
<pre>
String cookieName2 = "cfai.UserID";
Cookie newCookie = new Cookie(cookieName2, String.valueOf(userID));
newCookie.setDomain("localhost:8080");
newCookie.setMaxAge(3600 * 24 * 30 * 365); // response.addCookie(newCookie);
...
in another page:
Cookie[] cookies = request.getCookies();
for (int i=0; i<cookies.length; i++) {
System.out.println(cookies[i].getName());
}
</pre>
My app server is Tomcat3.1
Who can give me answer?