dcsimg
how can I create a login page which takes the user to his/her personal page.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Adam_W
Posted On:   Wednesday, April 9, 2003 06:08 PM

I am not very good at all this so I'd really appreciate some help.

How can I create a login screen which after verifying the password takes the user to a page holding their personal details?
Is there a link that anyone knows that has a tutorial on this?

really struggling here!
thanks all
Ads

Re: how can I create a login page which takes the user to his/her personal page.

Posted By:   Brian_Glodde  
Posted On:   Thursday, April 10, 2003 09:24 AM

Conceptually:


1.) Create your form with login/password fields.


...





...

2.) Set that form to post to a servlet or jsp that will try to select the record that belongs to that user:

String usr = request.getParameter( "username" );
if( usr == null ) usr = "";

String pwd = request.getParameter( "pwd" );
if( pwd == null ) pwd = "";

if( !pwd.equals( "" ) && !usr.equals( "" ) )
{
// now you can safely query the database to
// retrieve the users unique identifier
}

3.) If you have successfully grabbed the users unique identifier (assuming ROWID), then you can redirect to a personal information page, which will be populated by the unique identifier.

String redirectURL = "http://hostname.com/userinfo.jsp?id=" + userid_from_db;
response.sendRedirect(redirectURL);

4.) Finally, on the personal information page, you'll catch the incoming "id" from the request:

String uid = request.getParameter( "id" );
if( uid == null ) uid = "";

if( !uid.equals( "" ) )
{
// now go to the db and select all the attributes
// you'd like to display, using the "uid" variable
// as the key
}


Hope that helps

About | Sitemap | Contact