wood burning stoves*
The moose likes Servlets and the fly likes Login/Logout Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Login/Logout Problem" Watch "Login/Logout Problem" New topic
Author

Login/Logout Problem

Arshad Cs
Greenhorn

Joined: Sep 04, 2009
Posts: 3
I used a HTML page to accept username and password. The params are accepted by a servlet that checks them. If accepted, it redirects to servlet Home otherwise redirects to an errorpage.
On successful login the values are put in session so that it can be displayed in all other pages.

Now, the problem part. When logout is clicked, the user should logout ... i used session.invalidate() to do this.... and then redirect to login page again.......but if i click the Back button in browser. . . it works as usual

Please suggest something


------------
ArshadCS
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

Hi Arshad,

welcome to Java Ranch

your session is already invalidated. But when you click on back it shows last page you access, means at that page you are not check for session. So make always check for session, if session available or not. If session available process for further otherwise redirect to login page.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Arshad Cs
Greenhorn

Joined: Sep 04, 2009
Posts: 3
Thanks for prompt reply....

is that any method to clear history... so that the "back" button doesn't work at all ?
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

Read below link..

Clear History If User Click Back Button

This topic already discuss with Java ranch...
srinivas srinivasmeenavalli
Ranch Hand

Joined: Jul 13, 2008
Posts: 65
Refer this
webpage
Arshad Cs
Greenhorn

Joined: Sep 04, 2009
Posts: 3
I used the following code.... username and password are both checked to be admin/admin




Please correct me where i get wrong
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61084
    
  66

"Arshad Cs", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Login/Logout Problem