Hi everybody, I made an application that requires a login for the user. It works fine but I have only one problem.The login is in the page index.jsp.When an user makes a correct login it is redirect to the page loginSuccess.jsp. In this page there is a link to logout to go back in the index.jsp page. I have an only problem with this login. I want to disable the "Previous" button of the browser's window in the loginSuccess.jsp page.In this way,the user can make the logout only with the link that I made. How is possible to disable that button with Struts?Should I use some method in my Action class for the login?Is there any example for this problem? Thanks in advance, Mattia.
Putting the following scriptlet in index.jsp will insure that the session gets invalidated even if the user pressed the back button from the previous page to get there:
<% session.invalidate(); %>
This isn't fool-proof, though. The user could simply type another URL in the browser's URL line and navigate to another page. You just have to accept the fact that there will be a certain number of users who leave inactive sessions on your server. The web container will eventually get rid of them when they time out.
Hi Merrill, I appreciate your problem, but Is it not good to disable the back button when the user login and logout and tries to go back? I too want the code to disable the back button.
Joined: Feb 15, 2005
My main reason for saying that disabling the back button is a bad idea is that it annoys users. When I go to your website, I expect my browser to behave in a standard way, including an enabled back button. When I see that a site is trying to manipulate my browser to behave in non-standard ways, I will like as not just close the bowser and avoid the site. [ January 04, 2007: Message edited by: Merrill Higginson ]