This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes Auto login of the Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Auto login of the Page " Watch "Auto login of the Page " New topic
Author

Auto login of the Page

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

I want to develop Auto login Page .

for example it consists of two fields say a username and a password textfields.

Now i want to provide a check box under it with Label Do You want to remember ?

Which automatically logs me if i open the site again .

Please give me an idea as how to remember the username and password again when the user comes .

Thank You .



Save India From Corruption - Anna Hazare.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You'll need to do this with a cookie (search the forums for many examples). A fairly insecure mechanism, but it will do what you ask (assuming the same user uses the same PC to access your site and they don't clear down cookies).


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you paul .

I found the script with respect to this requirement .
But please tell me how this particular line can be useful in this ??

Calling a Javascript function on a checkbox (Remember Me) on to the form .



But can you please tell me what is the meaning of this line with so many parameters cookie.setMaxAge(365 * 24 * 60 * 60);

Thanks .

Nikhil Shah Jain
Ranch Hand

Joined: Apr 21, 2009
Posts: 31
This is stating the max age of the cookie for 1year i.e.,
365 days* 24 hour s* 60min *60secs
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There's only one parameter there, it happens to be an arithmatic expression.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Auto login of the Page