aspose file tools*
The moose likes JSP and the fly likes Session Timeout w/o xml? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Session Timeout w/o xml?" Watch "Session Timeout w/o xml?" New topic
Author

Session Timeout w/o xml?

Lila Fowler
Ranch Hand

Joined: Jul 31, 2009
Posts: 84
Hi all,

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?

Thanks


Courage is not the absence of fear but rather the judgment that something is more important then fear. ~ Ambrose Redmond
Prasanna Soundarapandiyan
Greenhorn

Joined: Sep 04, 2009
Posts: 9
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.
Lila Fowler
Ranch Hand

Joined: Jul 31, 2009
Posts: 84
Thanks Prasanna that works except onclick i just used a empty function.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60056
    
  65

Using the session as a timer is not an appropriate use of the session. If you need a timer, use a JavaScript timer.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Lila Fowler
Ranch Hand

Joined: Jul 31, 2009
Posts: 84
Hi Bear, I did use a timer as mentioned("I have written my own min/sec function") but the problem
still remained where I had to get an action result from the html.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60056
    
  65

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.
Lila Fowler
Ranch Hand

Joined: Jul 31, 2009
Posts: 84
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.

Thanks for all the help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Timeout w/o xml?
 
Similar Threads
Prevent timeout on parent jsp where applet resides
session timeout
Can session variables be stored in HTML
Session Timeout on Ajax Calls
Fade in-Fade out effect