struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Ratzlow <>
Subject Antwort: Re: Antwort: RE: howto redirect to login site after session expiration?
Date Mon, 23 May 2005 15:00:42 GMT

okay, but this leads to a solution where I do have to ensure a manuell 
redirect to the appropriate site by tracking session attributes. I thought 
that the container is maintaining a list of expired sessions (or at least 
valid sessions to figure out invalid sessions), so that I can _configure_ 
(web.xml sounds like a good place) what to do in the case of an expired 
session, means a session id stored in this list.
The problem with the NPE is a general prob that applies to all use cases 
where the user leaves some input site open in the browser and tries to 
submit it after the session timed out. The Struts framework finds no bean 
with bean with the formname specified in <html:form ...> in the newly 
created session so it creates a new one. Afterwards it tries to populate 
the bean but the new ActionForm isn't initialized yet (object graph) so 
all access to nested properties will result in a failure.

However, checking and handling expired session is IMHO very low level 
stuff the container should do for me. Isn't it?



Andrew Thorell <> 
23.05.2005 16:03
Bitte antworten an
"Struts Users Mailing List" <>

Struts Users Mailing List <>

Re: Antwort: RE: howto redirect to login site after session expiration?

This is what I use...

<logic:present ...>
    -- main body here --
<logic:notPresent name=...>
<logic:redirect ...>

Now if you're talking about the person filled out the form (or
whatever) and then let the session expire..  The first thing I would
check in the Validate Method would be to see if the session attribute
I put there when logging in was actually there. As for the NPE, I
debug based on trial and error sometimes and since I don't have your
full logic flow I can't give you a for certain answer, just

if ( request.getAttribute(" ") == null) //not sure what getAttribute
returns if nothing is there.

Hope this helps,


To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message