If the session expires and then they click on something it runs the action and then the action tries to get some info from the session which causes a null pointer exception. Is there anyway to have a pre-filter rather than a post-filter to send them to the page that says, says ex.-> 'your session has expired, please login again'
Sure just set up a servlet filter that looks for a valid session and if there isn't one you forward them to that page. Define your filter in your web.xml. I think the tomcat docs show an example... but for my app I have something like...
<filter>
<filter-name>NdaFilter</filter-name>
<filter-class>com.nielsenmedia.nda.ui.filter.NdaFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>NdaFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>NdaFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>In your custom Filter class which extends javax.servlet.Filter, you'll have a doFilter method in it where you'd add something like...
HttpServletRequest request = (HttpServletRequest)req; HttpServletResponse response = (HttpServletResponse)res; String contextPath = request.getContextPath();
HttpSession session = request.getSession(false);
if (session == null) {
log.debug("The session no longer exists");
response.sendRedirect(contextPath+"/sessionTimeOut.jsp");
return;
} else {
filterChain.doFilter(req, res);
}(Could be much better ways to accomplish the above, but the above should work)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

