wood burning stoves 2.0*
The moose likes Servlets and the fly likes Cookie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cookie" Watch "Cookie" New topic
Author

Cookie

Amit Mohan Tiwari
Greenhorn

Joined: Aug 21, 2006
Posts: 10
Can anyone tell me the following

Cookie(Stirng name , String value)

where the name and value of the cookies are stored ?
Is it stored in any context? if it is then which context?
Prabhakar Rao
Ranch Hand

Joined: Aug 23, 2006
Posts: 40
Cookies are for session management.
They are stored in Session Scope.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Prabhakar Rao:
Cookies are for session management.
They are stored in Session Scope.


Not true.
On particular type of cookie may be used for session managment.
Your cookies are stored in the user's browser.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Naresh Waswani
Greenhorn

Joined: Jun 02, 2006
Posts: 5
cookies are stored on the client system.

how the server gets these cookies from the client is in the form of header.

when the client sends a request to the server, it pass some information in the headers. one of the headers is

Set-cookie. this header contains name-value pairs and if there are more than on name-value pair it just separates them by ','.

for ex. if there are two cookies

name1 and value1 AND name2 and value2

the Set-cookie header looks like this:

Set-Cookie : name1=value1,name2=value2;

the server looks for this header name and once found he creates Cookie objects when you say request . get Cookies method.

Like Cookie c1 = new Cookie("name1","value1");
Cookie c2 = new Cookie("name2","value2");

I hop i made it clear.

regards

Naresh Waswani
9986461501
Amit Mohan Tiwari
Greenhorn

Joined: Aug 21, 2006
Posts: 10
The values too stored in the browser?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cookie