Hai, I am using using Struts1.1 to develop a webapplication. I am using sessions. My problem is if I did not perform any operation in the applicaition for a certain period of time session automatically expires and give the following error.
I want my application to login page whenever this exception occurs. How do I handle this in struts-config.xml with <global-exceptions>
I have written it like this <global-exceptions> <exception key="error.required" type="org.apache.jasper.JasperException" path="/login.jsp" /> </global-exceptions>
I agree with Mark, except that I think the code to check for the session should be put in an intercepting filter. That way, you only need to write the session checking code in one place, rather than in every Action.
Filter would work... except for in the most recent version of WSAD (for anyone out there using it) which has some strange bug where filters don't use the same session as everything else. In any other environment it's a great option.
Checking session in every Action that needs it might not be that bad of solution if not all Actions need it. If they DO, then the filter is certainly a good solution. It's not that much code. if(session==null)goCrazyNuts();
Joined: Jun 12, 2004
Thanks for the reply. I don't know how to use filters.
Is there any way of handling it. can you please tell me where I am going wrong while handling the Exception through <global-exceptions> option in stuts-config.xml.
It would be great if you me help out in this with out filters.