This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to attach/Detach cookies?" Watch "How to attach/Detach cookies?" New topic
Author

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

In JSP,

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).

hth,


Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
Thans Prabhu
 
It is sorta covered in the JavaRanch Style Guide.
 
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