there you go, it's taken from O'Reilly website.
vVolf
> -----Oryginalna wiadomooeæ-----
> Od: Mick Sullivan [mailto:[EMAIL PROTECTED]]
> Wys³ano: 23 marca 2001 21:12
> Do: [EMAIL PROTECTED]
> Temat: Login Servlet?
>
>
> Does anyone know where I could find code for a login servlet
> using JDBC.
> I have a login tested, it checks the database and it outputs
> whether the
> username and password are correct to the jsp page, but I need
> to use a
> servlet for redirecting the user.
> Here is the code i have for the login procedure
>
> public void applyChanges() 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);
> rs.close();
> statement.close();
>
> if(found == true)
> {
>
>
> System.out.println("THAT IS THE CORRECT USERNAME AN PASSWORD!!");
> //request.setAttribute
> ("servletName", "servletToJsp");
> rs.close();
> statement.close();
> //response.sendRedirect
> ("/login.jsp");
> }
> else
> {
> System.out.println("YOU
> ARE NOT IN OUR DB :-(");
> rs.close();
> statement.close();
> }
> }
> catch (Exception e)
> {
>
> }
>
> }
> }
>
> ANY help at all would be much appreciated. Thanks in advance, Mick
> ______________________________________________________________
> ___________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com.
>
LoginHandler.java