| Author |
Cookies Max Age problem
|
sreedhar Lackka
Ranch Hand
Joined: Jul 05, 2008
Posts: 154
|
|
Hi All, Thanks a lot in advance. I am tring to set cookie age using cookie.setMaxAge() in my struts action class but it is not working. if I remove this and add that is working fine. Please help me? Regards, Sree
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
but it is not working
What errors are you seeing? What behaviour are you expecting? Please TellTheDetails.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
sreedhar Lackka
Ranch Hand
Joined: Jul 05, 2008
Posts: 154
|
|
Thanks alot for your reply. The below code is working independently with JSP in Tomcat, Please replace K with C Kookie Kook1 = new Kookie("sred11573", "sreedhar"); cook1.setMaxAge (36500000); response.addCookie (cook1); Kookie[] cook2 = request.getKookies(); System.out.println("length--"+cook2.length); But if I test in WAS5.1 with Struts1.2.9 and Servlet 1.2 then it is not working. The cookies are not adding so last SOP is not printing as expected. Hope clear now. Working in IE 6.0
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information. You can go back and change your post to add code tags by clicking the .
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
sreedhar Lackka
Ranch Hand
Joined: Jul 05, 2008
Posts: 154
|
|
Thanks a lot for your replies. I tried some thing and found some thing but still surprise what is going on at behind the screen really surprisied and scared. The following code is perfectly working on WAS 5.1 , Strange is if I decrease the Max age value the cookis are not adding to browsers. But,in tomcat it is taking any value which is lesser than above value also. Please help me. I want my cookie should alive only for 1yr but with above it is 1.6 years.
|
 |
sreedhar Lackka
Ranch Hand
Joined: Jul 05, 2008
Posts: 154
|
|
Still waiting for solution
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
|
|
I dont see anything in the kookie RFC or the servlet API that prescribes a maximum Max-Age value. Perhaps your browser is rejecting or deleting the cookie for some other reason? Is there a possibility that some other code is modifying the Max-Age? How are you determining that the browser is not getting the cookie? Bill [ October 02, 2008: Message edited by: William Brogden ]
|
Java Resources at www.wbrogden.com
|
 |
sreedhar Lackka
Ranch Hand
Joined: Jul 05, 2008
Posts: 154
|
|
Using broswer options I am seeing that cookie. Which is very easy in firefox. But still my problem as is.
|
 |
 |
|
|
subject: Cookies Max Age problem
|
|
|