Hey all,

When my JSP session times out, I'm seeing an unexpected phenomenom. The 
session variable still exists, I can call getId() and the correct formerly 
valid session id is returned, but all the attributes stored in the session 
get wiped away. So, I wanted to monitor when these attributes get blown 
away so I could do something (like manually invalidate the session or 
something). I created an object that implemented the 
HttpSessionAttributesListener interface, configured web.xml, and was able 
to monitor the adding, replacing and removing of session variables. And in 
general this works, except when the variables are replaced/removed by the 
session timing out! Anyone know a solution to this?

In case you're wondering the core problem that I'm trying to solve is that 
of a NullPointerException that gets thrown when a user is logged in, on a 
JSP page, goes away and the system times the user out, the user comes back 
and does something like hit a submit button and my servlet (I'm using 
struts, so it's an Action instance, but for those not familiar, it's just a 
servlet) gets ahold of the user's session using the standard 
request.getSession(), tries to retrieve a session variable and viola I get 
the NullPointerException. I don't want to wrap all my code with try blocks 
if I don't have to, I simply want my application to go back to the login 
page if the session has timed out.

Any help would be much appreciated,
-adamw


Reply via email to