Reputation: 21981
I want to store some user data into a cookie so it's always there when they load the web app, even if the session has expired.
What's the best way of doing this with JSF?
Upvotes: 11
Views: 12664
Reputation: 13571
Writing to a cookie:
FacesContext.getCurrentInstance()
.getExternalContext()
.addResponseCookie("CookieName", "value", null);
Reading the cookie
Map<String, Object> requestCookieMap = FacesContext.getCurrentInstance()
.getExternalContext()
.getRequestCookieMap();
Upvotes: 20