participate


Java Servlet - Login page using servlets linked to a mysql database
<<   Back to Forum  |   Give us Feedback
This topic has 1 reply on 1 page.
danik
Posts:28
Registered: 11/28/07
Login page using servlets linked to a mysql database   
Nov 28, 2007 8:59 AM

 
Hi,

I have created a login html page which executes my login servlet which connects my mysql database and if username & password are correct returns the name and address of the user from the database through in html format.

I have a few questions

1. how do i create an error page? so if the account doesnt exist etc it returns an error page

2. How do i make it create a session and a new cookie once its logged in the user?

Regards Nick
 
BalusC
Posts:29,784
Registered: 4/26/06
Re: Login page using servlets linked to a mysql database   
Nov 28, 2007 9:18 AM (reply 1 of 1)  (In reply to original post )

 
1. There are several ways. Best case is to show an userfriendly message somewhere in the form, in the top, or next to input field, or below the button, etc.

2. The webcontainer already does that for you. General approach is to put the User object as attribute in HttpSession so that your application can intercept on that. If session.getAttribute("user") returns null, then the user is not logged in.
 
This topic has 1 reply on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 25
  • Guests : 129

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums