File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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: 39549
    
  27
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 - updated with new look and Ping home screen widget
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: 39549
    
  27
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: 60058
    
  65

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
 
Similar Threads
null exception when using session
delete session with button
Constructor Problem
help: getParameter returning null!
syntax and error in ncf log