Meaningless Drivel is fun!*
The moose likes JSP and the fly likes How to attach/Detach cookies? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to attach/Detach cookies?" Watch "How to attach/Detach cookies?" New topic

How to attach/Detach cookies?

Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
I want to invoke a website(login/logout) and attach/detach cookies using java....I'll appreciate any help possible´┐Ż..
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

you can add and get cookie using HttpServletResponse, HttpServletRequest


1. you can add cookie using response implicit object.

2. you detach cookie by setting maxAge(maximum time).

3. you can get the added cookie using request implicit objects.

Cookie[] cookie = request.getKookies();

4. you can replace cookie with using key with different value (which will replace cookie with new value).


Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />
Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
Thans Prabhu
wood burning stoves
subject: How to attach/Detach cookies?
Similar Threads
Disappointed w/ Hibernate
JNI: Any way to tell if I am on a Java thread?
detach hibernate objects
How tp detach a Frame from the Main Application ?
Find out which jsp page called the concerned page