wood burning stoves 2.0*
The moose likes Struts and the fly likes How to properly handle server Timeout ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to properly handle server Timeout ?" Watch "How to properly handle server Timeout ?" New topic
Author

How to properly handle server Timeout ?

Franck Tranchant
Ranch Hand

Joined: Aug 07, 2003
Posts: 75
Hi
I'm currently working on a struts-based application running on Weblogic 7.0 and I wonder how to properly handle server Timeout.
For the moment, i've nothing special configured/coded so, when the weblogic "Session Timeout" for my application happens, naturally, i do have an horrible error message on screen due to NullPointerExceptions in the Action class.

So, how could I detect the timeout and then forward to a specific JSP ?
Many thanks in advance..


Franck<p>--------------------
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4792
    
    8

One option is to use a Filter configured for your ActionServlet. You would set a session-scoped attribute and the filter would check for it.
Another option is to use the Token mechanism in the Action class. See http://www.husted.com for examples in using the Struts token.


Junilu - [How to Ask Questions] [How to Answer Questions]
Franck Tranchant
Ranch Hand

Joined: Aug 07, 2003
Posts: 75
What about this one :
In every Action class, I first check the
request.isRequestedSessionIdValid() boolean flag at the begining of the execute method.
The false value throws an Exception that can be caught and forward the user to a particular JSP with the right error message.
Works fine for me.
What do you think ? Does it make sense to you, Struts experts ?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to properly handle server Timeout ?