简体   繁体   中英

JSF “Remember me” option

In other languages when a user logs in you can set the expire date of a cookie really far from today's and you can achieve this. How can I implement this in JSF2? I have a jsf sessionscoped bean but how can I maintain this session for a long time?.

You can add cookies with JSF as well:

FacesContext.getCurrentInstance().getExternalContext.addResponseCookie(..)

in the parameters map you can set the expiration date - see the documentation for all parameteres

我知道这被标记为JSF,但我建议您研究Spring的“记住我”问题的解决方案。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM