Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[Solved]Cookie in adf faces application

581206Aug 3 2007 — edited Aug 6 2007
I am trying to add cookie in ADF Faces application and i am Using the sample code

-2:
Cookie userCookie = new Cookie("myCookie", vcookie);
userCookie.setMaxAge(-1);
FacesContext ctx = FacesContext.getCurrentInstance();
((HttpServletResponse) ctx.getExternalContext().getResponse()).addCookie(userCookie);

3.
Cookie retrieveCookie = (Cookie) context.getExternalContext().getRequestCookieMap().get("myCookie");
if (retrieveCookie !=null)
System.out.println("My cookie is: "+retrieveCookie.getName()
+ " " + retrieveCookie.getValue());

found in forum 1762538


It looks like it is working okay for me in jdeveloper , but in application server It keeps my selection if I stay in and switch between pages, but if I quit browser and come back, my settings are lost. i am setting the age of 1 year myCookie.setMaxAge(60*60*24*365);

i am not sure what to change here

Thanks

Message was edited by:
Rao
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 3 2007
Added on Aug 3 2007
6 comments
2,791 views