Problem with cookies

M

marty mcmahone

Trying to work out cookies and having a baffling problem. I did a simple
routine that wrote a user login and password -- it worked fine. Now I'm
trying to do basically the same thing, but this time I have four cookies.
What's happening is that no cookies are being written.

Here's the method I'm using:

private void createCookie(HttpServletResponse response, String name, int
value)
{
String outString = value + "";
Cookie temp = new Cookie(name, outString);
temp.setMaxAge(60*60*24*7);
response.addCookie(temp);
System.out.println("wrote cookie: " + name);
}

I tried doing it inline in the code as well, but that didn't make any
difference (as, of course, it shouldn't). Immediately after this routine is
executed, I close the PrintWriter file I'm building and exit the primary
method. The S.o.p. here does print, but there is no cookie getting written.

I'm using Tomcat as my development server. Anybody see what dumb thing I
must be doing?

Thanks

Marty
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top