Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

struts session time out

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using struts and JSP's I want to redirect upon timeout to the login page. I check the session in each page and if it doesn't exist, I send them . The problem with this is that the user needs to submit something. They might think they have a session until they hit submit.

and its too tedious to do this on each and every page is there some other way in struts using web.xml or struts-config.xml
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is how the web works.
The server can only respond to requests made bye the client.

You could however try some Javascript solutions.

1) create a javascript timer that resets itself with each call to the server.
If the timer reaches 30 mins (or whatever your session timeout is) then it alerts the user, telling them that their session has probably timed out.

2) you could have a polling frame run to keep their session active while they have the browser open.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your question is off topic for this forum.

This forum is for Servlets questions.

I am going to move this thread to the more appropriate, Struts forum

Thanks and good luck

Mark
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mentioned that it is too tedious to check for the existence of the session in every action. You might consider writing an abstract Action class that contains the logic for checking for the session and performing the appropriate forward if it doesn't exist. You could then extend all your action classes from this class.
 
Legend has it that if you rub the right tiny ad, a genie comes out.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic