JSF中的会话超时 [英] session-timeout in JSF

查看:116
本文介绍了JSF中的会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码在JSF中创建会话对象.问题是,当我尝试访问userdet对象后,它可能由于会话超时而给了我异常.无论如何,有没有增加JSF中的会话超时的方法.

I use the following codes to create a session object in JSF. The problem is that after sometime when I am trying to access userdet object it is giving me exception possibly because of session timeout. Is there anyway to increase the session timeout in JSF.

            FacesContext context = FacesContext.getCurrentInstance();
            HttpSession session = (HttpSession) context.getExternalContext().getSession(true);
            session.setAttribute("userdet",user);

当我使用servlet时,我使用以下代码,但是它也适用于JSF吗?

When I use servlet I use the following codes but is it applicable to JSF also?

<web-app ...>
    <session-config>
        <session-timeout>20</session-timeout>
    </session-config>
</web-app>

推荐答案

是. JSF应用程序的会话超时也在web.xml中设置.

Yes. Session timeout for JSF applications is set in web.xml too.

实际上,JSF使用Java Servlet来处理http请求和响应.

In fact JSF makes use of Java Servlets to handle http requests and responses.

这篇关于JSF中的会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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