Originally posted by rohit mehta:
Hi all
A struts based site,
Problem is that after logout, if i click to "back" button from browser, i am on previous page & can do any operation successfully, as login.
Can anybody tell me how to handle it?
thanks
You can use the struts RequestProcessor class. As per struts architecture any request before reaching the action class passes through the RequestProcessor.
We can use RequestProcessor class by extending it with our custom class. IN the custom class we can do the login check and in case of failure dispatch the request to session expire
jsp.
if( session != null && session.getAttribute("userName") != null)
return true;
else{
try{
//If no redirect user to login Page request.getRequestDispatcher ("/Login.jsp").forward(request,response); }catch(Exception ex){ } }
In the struts config we need to make the following entry
<controller> <set-property property="processorClass" value="com.sample.util.CustomRequestProcessor"/> </controller>