• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is wrong with my cookie?

 
Joe Wang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi people,
I used following code to test Cookie:
........
public void doGet(... req, ... res)throws ...,..{
HttpCookie cookie = new Cookie("userName","someOne");
res.addCookie(cookie);
res.setContentType("text/html");
//Next, get PrintWriter to send response to client
}
.....
The code was successfully compiled and run without any exception.
But, when I checked the temporary directory of IE, where the cookies should be stored, I could not find any cookie file.Why?
Does anybody can tell the reason?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding is that the default max age value is -1 meaning that the cookie lasts until the browser shuts down - thus it does not have to be stored.
See the setMaxAge method API.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic