JSF“记住我”选项

时间:2011-02-12 23:14:47

标签: java jsf jsf-2 session-timeout

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

2 个答案:

答案 0 :(得分:4)

您也可以使用JSF添加Cookie:

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

在参数图中,您可以设置到期日期 - 有关所有参数,请参阅the documentation

答案 1 :(得分:0)

我知道这是标记的JSF,但我建议您查看Spring's Solution to the Remember Me problem.