servlet authentication and further reference to the credentials
        Posted  
        
            by 
                user553592
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user553592
        
        
        
        Published on 2010-12-24T22:46:00Z
        Indexed on 
            2010/12/24
            22:54 UTC
        
        
        Read the original article
        Hit count: 183
        
What I got so far:
It all begins with an HTML form which prompts the user for a username and password. From there it post the acquired user/pass to a servlet, GateKeeper. GateKeeper determines if the user/pass combination match any records in the MySQL database.
Here is the sql I use: SELECT id FROM Users WHERE username='?' AND password=MD5('?') where the ? indicate information provided the previous HTML form.
What I need now: I need some way to store the username and id of the record in the database. GateKeeper redirects the user to a control panel upon success. Therefore, I need a method to reference the username to display simple greetings, etc and also the id so it eliminates unnecessary calls to the database. The control panel may make AJAX calls to Servlets that preform some sort of task to the MySQL database.
© Stack Overflow or respective owner