Hi
I try to save and load cookies from my Myfaces projekt. I see that I save the cookies in the response but if I load the cookies again I can just find the myfaces cookies but not my ones.
Here is the code which I use:
load code:
public void ladeCookie() {
Cookie[] cookies;
FacesContext faces = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) faces
.getExternalContext().getRequest();
cookies = request.getCookies();
for (int i = 0; i < cookies.length; i++) {
if (cookies[i].getName().equals(SessionUser.DATENBANK)) {
this.setDatenBank(cookies[i].getValue());
}
}
}
save code:
public void speichereCookies() {
Cookie c = new Cookie(SessionUser.DATENBANK, this.getDatenBank());
c.setMaxAge(-1);
FacesContext faces = FacesContext.getCurrentInstance
();
HttpServletResponse response = (HttpServletResponse) faces
.getExternalContext().getResponse();
response.addCookie(c);
this.ladeCookie();
}
Hope this is enough to find the problem.
Thanks in advance.
--
mfg Hans Sowa
mailto:[EMAIL PROTECTED]
- Problem with cookies Hans Sowa
- Re: Problem with cookies Hans Sowa
- RE: Problem with cookies David G. Friedman
- Re: Problem with cookies Hans Sowa

