Hari, You are correct.

That fact makes the problem more tricky, a solution is below...  It assumes
that doing something is either a mouse move or a key press, that should be a
reasonable assumption for this problem I think...

<script>
//5 min = 5 * 60 * 1000 ms
var msec = 300000;
//store intervalID as a global variable
var intervalID = setInterval("timeOut()", msec);

//if a user does something give them 5 more min
document.onkeypress = resetInterval;
document.onmousemove = resetInterval;

function timeOut()
{
        document.location = "/lock.jsp";
}

function resetInterval()
{
        //cancel previous timer
        clearInterval(intervalID);
        //make a new one
        intervalID = setInterval("timeOut()", msec);
}
</script>

_____________________________________________
Pete Freitag ([EMAIL PROTECTED])
CFDEV.COM
Web Developer Resources
http://www.cfdev.com/
 Check out ActivEdit a WYSIWYG HTML Editor that works like a Textarea
 http://www.cfdev.com/activedit/

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Hari Yellina
Sent: Monday, October 29, 2001 10:04 PM
To: [EMAIL PROTECTED]
Subject: Re: Inactive Time.


Dear Freitag,

 Thanks for you answer. It definelty works, If  I am there for 5 minutes.
But a small problem. I want to redirect the page , if the user is inactive
for 5 min. But your answer would work, if the user is there and using the
application . every 5 minutes it is going to redirect.

 Thank you in advance.

Regards,
Hari.
----- Original Message -----
From: Pete Freitag <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 30, 2001 1:41 PM
Subject: Re: Inactive Time.


> You can do this with java script, try something like this...
>
> <script language="JavaScript">
>
> file://call the timeOut Function in 5 minutes
> setTimeout("timeOut()", (5*60*1000));
>
> function timeOut()
> {
>         file://redirect to a page that will expire the session on the
server
>         document.location = "/expireSession.jsp";
> }
> </script>
>
> _____________________________________________
> Pete Freitag ([EMAIL PROTECTED])
> CFDEV.COM
> Web Developer Resources
> http://www.cfdev.com/
> Check out ActivEdit a WYSIWYG HTML Editor that works like a Textarea
> http://www.cfdev.com/activedit/
>
>
>
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Hari Yellina
> Sent: Monday, October 29, 2001 9:16 PM
> To: [EMAIL PROTECTED]
> Subject: Inactive Time.
>
>
> Hi All,
>
>  I am developing Point of Sale Application. I want user to lock the System
> in 5 minutes. It has to happen automatically, if the user is not using for
a
> 5 minutes.
>
> If any one had solved this problem. Please mail and a piece of code would
be
> of great Help
>
> Regards,
> Hari.
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to