I am using struts2jquery grid plugin for my app. I am using interceptor for session timeout and I am configuring my session timeout in web.xml, But the problem is after session timeout it is not going to required page say login.jsp , my struts.xml is as follows..
....
<interceptors>
<interceptor name="SessionCheckInterceptor" class="com.org.SessionCheckInterceptor" />
<interceptor-stack name="testSessionValidationStack">
<interceptor-ref name="SessionCheckInterceptor" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
...
<action name="mytable" class="com.org.MyTable">
<interceptor-ref name="testSessionValidationStack"/>
<result name="success" type="json"/>
<result name="error">messages.jsp</result>
<result name="sessionexpired">login.jsp</result>
</action>
...
I able to go in interceptor class while debug but it not redirect me to the login page. Please anybody tell me what is the problem in my code?
My interceptor method is..
public String intercept(ActionInvocation actionInvocation) throws Exception {
ActionContext context = actionInvocation.getInvocationContext();
Map<String, Object> sessionMap = context.getSession();
log.info(" retrived session..." + sessionMap);
if (sessionMap == null || sessionMap.isEmpty()
|| sessionMap.get("userName") == null) {
log.info(" session expired...");
addActionError(actionInvocation,"Session has been expired,please login again.");
return "sessionexpired";
}
String actionResult = actionInvocation.invoke();
return actionResult;
}