views:

43

answers:

1

Hi,
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.

A: 

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.com/Tutorial/Java/0400__Servlet/ServletSessionMaxInactiveInterval.htm

YoK
ya Its help for me.
EswaraMoorthyNEC
can you then accept my answer/rate it up ?
YoK
@eswaramoorthy-nec Can you accept my answer. This will also improve your accept rate (which is 0%). Higher accept rate motivates people to answer question asked by you :).
YoK