aspose file tools*
The moose likes Servlets and the fly likes Using sessions for authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using sessions for authentication" Watch "Using sessions for authentication" New topic
Author

Using sessions for authentication

Jahar Heard
Greenhorn

Joined: Jan 09, 2010
Posts: 20
I want to ask you something, how to use this session, when I log in , and then refresh the page it's back to the login form, I thing I'm doing something wrong.



Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
What is the relationship between the session and whether or not the login page is shown? The code excerpt you posted doesn't show that.


Ping & DNS - my free Android networking tools app
Jahar Heard
Greenhorn

Joined: Jan 09, 2010
Posts: 20


Here is my login form.

The code is "working".But when I log in, and when it display my name, when I refresh the page, login form appear, and the name disappear.I think my problem is whit the session .

Any Ideas ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
There should be some logic in the doGet method that checks whether a session exists, and -if there is one- does something other than display the login form - maybe redirect to the main page.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

Rather than checking for a session, check for the existence of something in the session. Much less fragile.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using sessions for authentication