JSF “Remember me” option

2019-04-13 06:28发布

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

2条回答
趁早两清
2楼-- · 2019-04-13 07:09

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

查看更多
狗以群分
3楼-- · 2019-04-13 07:11

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

查看更多
登录 后发表回答