Hi all
Does anyone know where I could find code that when after a user has given a 
correct username and password on the login.jsp page, a loginHandler bean 
will redirect the user to a new page, and if the user gives a username and 
an incorrect password, the login page will appear again.
I have the bean checking the DB and validating the username and password 
with the following code:

public void loginHandler() throws Exception
    {
        Statement statement = connection.createStatement();
             try{
                ResultSet rs = statement.executeQuery("SELECT * FROM                
                Registration WHERE (Username ='"
                                  + theUsername
                                  + "' AND Password = '"
                                  + thePassword + "');");
                                  boolean found = rs.next();
                                  System.out.println(found);
                                if(found == true)
                                {
                                        System.out.println("THAT IS THE CORRECT 
USERNAME AN PASSWORD!!");
                                }
                            else
                            {
                                        System.out.println("YOU ARE NOT IN OUR DB 
:-(");
                            }
                        }
                    catch (Exception e)
                    {

                    }

    }
}

Any help would be much appreciated,
Thanks in advance, Mick
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Reply via email to