| Author |
cookies
|
Ankur Jain Kothari
Ranch Hand
Joined: Feb 08, 2010
Posts: 152
|
|
hfsj says that cookies can contain name/value string pairs...example whenever i start my gmail page it already contains my name and password...but what does
But you can tell a cookie to stay alive even after the browser shuts down
mean?
i thought cookie is associated with a session and session ends with the shut down of the browser..can anyone clarify
|
Do What You Wanna Be....Taking Things The Way They Come
scjp 1.6 91 percent, scmad 90 percent(rounded off to nearest integer)
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9090
|
|
|
Cookies and sessions are a different thing. JavaEE uses Cookies to identify clients associated with a particular session (this is just one of the ways to identify a client's session). You can create cookies on the client machine independently of the session. There's no need for a session to be present for sending a cookie with a response...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Swagato Bhatta
Ranch Hand
Joined: Nov 08, 2008
Posts: 72
|
|
Ankur Jain Kothari wrote:hfsj says that cookies can contain name/value string pairs...example whenever i start my gmail page it already contains my name and password...but what does
But you can tell a cookie to stay alive even after the browser shuts down
mean?
i thought cookie is associated with a session and session ends with the shut down of the browser..can anyone clarify
Session uses cookies to make stateful conversation. AM I right? ??
Since webcontainers are stateless, cookies are used. Now when browser is shut down or the session ends, the cookie can still sruvive. I think in web.xml you can say for how long you can keep the cookie to stay alive. I am reading right now in the book that it can also be done programetically.. but I have not tried that yet.
Anyhow, yes cookie can stay alive long after your browser is not there. However, a session can be there without cookie. Imagine a situation where the client has deliberately disabled cookie. What happens then? I think you can then use sessionID appened to browser URL ....Am I right? Actually the webconatiner does this for you? However, you have to say it somewhere...umm still studying that....
That is my knowledge so far about this. Hope this helps somehow
|
Working on my SCWCD so I can be a J2EE consultant earning millions of dollars and showing everyone I can
|
 |
Ankur Jain Kothari
Ranch Hand
Joined: Feb 08, 2010
Posts: 152
|
|
the age of the cookie can be altered programmatically and not in the web.xml file. Only the age of session can be done both ways.
I think in web.xml you can say for how long you can keep the cookie to stay alive.
|
 |
Swagato Bhatta
Ranch Hand
Joined: Nov 08, 2008
Posts: 72
|
|
Ankur Jain Kothari wrote:the age of the cookie can be altered programmatically and not in the web.xml file. Only the age of session can be done both ways.
I think in web.xml you can say for how long you can keep the cookie to stay alive.
oh yes thanks :-)
|
 |
 |
|
|
subject: cookies
|
|
|