Im trying to create a session timeout of 30sec on a html page if there is no user activity,
my problem is that if the user is busy filling in required fields(eg: 10 fields) on a form in html,
but has not yet submitted the values to a js page, then the session should stay active.
But if there is no activity on on the html page for 30sec it should auto Log Off.
A good example of what i'm trying to do is a touch phone. If there is no user interaction for
x seconds it auto locks or the light switches off.
The jsp page/function is called only once the submit button is pressed, not at every field and there are no xml pages allowed.
If is possible to do this with session timeout?
I have written my own min/sec function that auto counts down without using session but I cannot figure out how to implement an
"action listener" for actions performed on an html page.
Any ideas on how I could solve this problem or if it is at all possible?
Courage is not the absence of fear but rather the judgment that something is more important then fear. ~ Ambrose Redmond
If i am not wrong you can try out onething, onchange or onclick of any where in the screen , process an ajax call without any action. Just a simple server hit. There by you can avoid session getting timed out.
Joined: Jul 31, 2009
Thanks Prasanna that works except onclick i just used a empty function.
Lila Fowler wrote:but the problem still remained where I had to get an action result from the html.
You'll need to better explain what you mean by that.
Joined: Jul 31, 2009
By action I meant any input, select, search or touch performed by the user on the screen.
I didn't use session timeout as it is incorrect as I read in the other posts relating to this query, but since my html page(should only contain html, no functions) and jsp page(all functions) are separate files I was unable to figure out how to reset my timer, as the function(jsp) was only called on the submit button(eg: onclick="function" --> an action). If there where 20 html fields to be filled in then there was no way a user could complete a form like that in 30sec. I could have used the onclick() for every field to reset but that would have been messy and un-dynamic. So Prasanna pointed me the obvious solution: Create a div that calls the timeResetFunction once, due to the div property every time a field or element is pressed by the user the function is auto called resetting the timer, but if no action is done within 30 sec the logOut function activates.
I hope I have explained this better? In retrospect maybe the xml/html forum would have been a better option, but when I was asking the question I was under the impression that I would have to use js to determine if any fields where selected or actions performed maybe using mouse movement/push.