JSF“记住我”选项 [英] JSF "Remember me" option

查看:122
本文介绍了JSF“记住我”选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在其他语言中,当用户登录时,您可以将Cookie的过期日期设置为远离今天,并且您可以实现此目的。我怎样才能在JSF2中实现它?我有一个jsf sessionscoped bean但是我怎么能长时间保持这个会话?。

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

推荐答案

你可以用JSF添加cookie以及:

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“记住我”选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆