• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Login Problem

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although there are sophisticated ways to disable the back button using JavaScript, it's usually very annonying to most users when you do so. If you're worried about the fact that the session is still active if the user hits the back button, there are other ways to make sure the session is invalidated. Example:

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.
 
Mattia Merenda
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill,
your simple solution is not good for my project.
I want the user must not hit the button for the previous page.
Tell me some more complicated example.
Thanks,
Mattia
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Out of curiousity, why can't the user go back to the login page when they are already logged in?

Even on my bank's website I can go back to the login after I logged in.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I still think it's a bad idea to try and disable the back button, but if you Google "JavaScript disable back button", you'll see some clever ways of doing it.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Thanks,
Ashish
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic