| Author |
Persistent Cookies in Servlets
|
Reema Patel
Ranch Hand
Joined: Jan 26, 2006
Posts: 169
|
|
Hello All, I have the following simple App: ---------------The method name is changed in the code accrd. to the JavaRanch naming convention--- TestCookieServlet- In this servlet, I'm creating a new cookie and adding the same to the response, and finally forwarding the request to another component. DisplayCookies In this file I'm getting all cookies from the request, as shown here: I have two queries: (1) For the first time when I request TestCookieServlet (whin inturn forwards the call to DisplayCookies) I get to see- "There are no cookies for this request". But, when I refresh the page I get the cookies name and value. Why it doesn't show me the same result on the first request? (2) Why is the path always shown null? Any help shall be highly appreciated. Thanks, Reema [ January 13, 2007: Message edited by: Reema Patel ]
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
|
|
If I correctly understand your question - Cookies are set in the response and the browser will not get the cookies until the response is sent. The servlet will not see cookies until the NEXT request. Bill
|
Java Resources at www.wbrogden.com
|
 |
Reema Patel
Ranch Hand
Joined: Jan 26, 2006
Posts: 169
|
|
Hi Bill, Thanks for the post. I think you have a point. Now, instead of a forward I'm doing a redirect and thinks are looking pretty. Thanks, Reema
|
 |
 |
|
|
subject: Persistent Cookies in Servlets
|
|
|