aspose file tools*
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 Spring in Action this week in the Spring 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to attach/Detach cookies?