I have written a custom interceptor for disabling back button functionality in browser. But code is not working. i have added meta tag in html also. I do not want to use java script for this.
public String intercept(ActionInvocation invocation) throws Exception {
final ActionContext actionContext = invocation.getInvocationContext();
HttpServletResponse response = (HttpServletResponse) actionContext.get(StrutsStatics.HTTP_RESPONSE);
if(response != null){
response.setHeader("Cache-Control", "no-cache, no-store");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "-1");
}
return invocation.invoke();
}
Can i write a custom interceptor which will check if user session is exists it will redirect on the same page from where user clicked browser back button.
Any suggestion how can i implement it.
Ok so I have found a solution which disable back button functionality.
I have created one action with name
RedirectAction
which checks if session is exist or not. if session exists then it redirects user on home page otherwise on login page.