Two Laptop Bag*
The moose likes Servlets and the fly likes What is wrong with my cookie? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "What is wrong with my cookie?" Watch "What is wrong with my cookie?" New topic

What is wrong with my cookie?

Joe Wang

Joined: Sep 19, 2003
Posts: 3
Hi people,
I used following code to test Cookie:
public void doGet(... req, ... res)throws ...,..{
HttpCookie cookie = new Cookie("userName","someOne");
//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

Joined: Mar 22, 2000
Posts: 12761
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.
It is sorta covered in the JavaRanch Style Guide.
subject: What is wrong with my cookie?
Similar Threads
Writing Cookies
Confusion between Cookie and JSession
setMaxAge on cookie using JSTL
Cookies not getting reset in Netscape 4.72!!! URGENT!!!
how to make remeber me service