最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to set session max inactive time? - Stack Overflow

programmeradmin9浏览0评论

I get the session MaxInactiveInterval time using the following query. I am developing web application using JSF Framework

var sessionMaxInactiveTime = ${pageContext.session.maxInactiveInterval};

I need to set maxInactiveInterval.
how to set maxInactiveInterval using JavaScript, JQuery, or to write Servlet.
But i want to control to main template jsp Page.

Is available any links, notes or samples?

Help me. Thanks in advance.

I get the session MaxInactiveInterval time using the following query. I am developing web application using JSF Framework

var sessionMaxInactiveTime = ${pageContext.session.maxInactiveInterval};

I need to set maxInactiveInterval.
how to set maxInactiveInterval using JavaScript, JQuery, or to write Servlet.
But i want to control to main template jsp Page.

Is available any links, notes or samples?

Help me. Thanks in advance.

Share Improve this question asked Jul 12, 2010 at 2:52 EswarEswar 2934 gold badges15 silver badges28 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 2

In doPost or doGet method in your servlet, first get Session object and call setMaxInactiveInterval() method on Session. You can similarly get session object & set max inactive interval (by calling setMaxInactiveInterval() method) from your JSP page.

Below is servlet example:

    // Get the current session object, create one if necessary
    HttpSession session = req.getSession();
    // Set the timeout
    session.setMaxInactiveInterval(2*60*60);  // two hours

You can find similar and more examples related to Servlet and sessions here :http://www.java2s./Tutorial/Java/0400__Servlet/ServletSessionMaxInactiveInterval.htm

发布评论

评论列表(0)

  1. 暂无评论