This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Session Timeout redirection not working properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Timeout redirection not working properly" Watch "Session Timeout redirection not working properly" New topic
Author

Session Timeout redirection not working properly

Radhika Reddy
Ranch Hand

Joined: Oct 31, 2002
Posts: 30
Hi,
Our application is a Struts based J2EE Application.We want to specify SessionTimeout as 45 Minutes.So I did this by adding Session-Config element in web.xml and set Session-timeout as 45.We want to redirect to different page when client tries to click on page after SessionTimeout.we added error pages for error codes 400,404,500,408 etc.Before ,We saw it throwing 500 error when session is timedout.So we added custom page to show when error is 500.But its not working as expected still its showing something as
<TD class="d1" NOWRAP error 500 server caught unhandled Exception.
Is it the right way that I used to redirect to SessionTimeout page when session is timed out?If so why its not working..?Need help..Its Urgent..
Thanks,
Rajasekar Kayamboo
Greenhorn

Joined: Sep 04, 2003
Posts: 9
I am also working on STRUTS application. For session timeouts and re-direction we always do that in the action class. The limitaion is that the user will not be automatically taken to the redirected page but only if he clicks any link/button after the timeout he will be redirected.
Sekar


Sekar
Radhika Reddy
Ranch Hand

Joined: Oct 31, 2002
Posts: 30
Hi,
We want the samething to happen like when user clicks after session timeout he should see new session Timeout page.Can you give me the code example like how you did it in action class?..
Thanks,
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Just do
HttpSession session = request.getSession(false);
if session is null redirect to a session time out page.


Groovy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Timeout redirection not working properly