File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes hi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "hi" Watch "hi" New topic


Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
How can i store my username and password when i open my website.I mean i want to store my username and password at whole time .So how can i proceed
Hari babu
Ranch Hand

Joined: Jun 25, 2001
Posts: 208
you can store that in servletContext. But not sure what you are trying to do by storing username and Password in application context.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

If you are refering to loging in, you should look into the J2EE authentication mechanisms.
You can (for example) define a login screen, the username and password will be validated automaticaly for you and stored on the session. Have a look at Basic or Form-based authentication.
Also see HttpServletRequest.getRemoteUser() and HttpServletRequest.getUserPrincipal() to see how the security details are stored internally.
Please try to use more descriptive topics in your threads. Help us help you.
Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
Actaully i need to develop forumn website my self.
so according to this website i need to store password and username in client pages once visit website.So which concept i can use for this facility.
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
u could use persistent cookies to store the username on the client . Storing the password in the same cookie is also possible provided the Client selects to do so as we find on several sites with The Remember Me CheckBox.
I agree. Here's the link:
subject: hi
It's not a secret anymore!