JSF “Remember me” option

有些话、适合烂在心里 提交于 2019-12-06 10:52:02

问题


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?.


回答1:


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




回答2:


I know this is tagged JSF but I recommend you look into Spring's Solution to the Remember Me problem.



来源:https://stackoverflow.com/questions/4981246/jsf-remember-me-option

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!