tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mick Sullivan" <mick...@hotmail.com>
Subject Login Handler Question
Date Thu, 22 Mar 2001 15:07:51 GMT
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.


Mime
View raw message