This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i m developing a web application where i have provided the facility for user login. I can allow user to login successfully. when user logs out, he is directed to the login page. but when he presses BACK button of the browser, he is again redirected to the previous page. i m using jsp for session management. can anybody solve my problem by giving a simple example, please.....
Are you sure that after you log out, you just want to direct it back to Login page and handle that client side ?
Usually you would go for destroying the session, time it out... save any data if required so why dont you go for a session listener and use the 'destroy' method to do so and use the action to come back to the login page again ....
and I assume that you dont want the user to move back and do any more editing in your web application...so again, are you are validating the authority of the user everytime you traverse through your pages?... if yes.. just go to the exception page (or login page) if the user is trying to go back after logout using a listener or an action.
Time is what we want the most, but what we use the worst. -- William Penn
This problem, has got nothing to do with sessions, its the problem with browser caching the page, when user clicks back, browser is showing you a cached page. So declare no-cache as true in JSP. I assume that, you are doing session.invalidate() after, once user clicks logout. If not, first destroy/invalidate the session..
Deepakkumar Devarajan wrote:Use window.history.forward(1); in your script, whenever you click button, you will be redirected to the current page. Hope this helps
Hi there ,
I had the same problem , so I have used your code in logout.jsp page like this .
Is this the right way to do this ?
When I click on button , the page goes to index.jsp and when I click the back button, it does not go back to logout.jsp page. That is what I want. However , I want to make sure that this is done the RIGHT WAY.