I believe that the bean can be handled the same way as the Servlet which mean
that you can use:

// Set the attribute and Forward to hello.jsp
            request.setAttribute ("servletName", "servletToJsp");

getServletConfig().getServletContext().getRequestDispatcher("/jsp/jsptoserv/hell
o.jsp").forward(request, response);

----- Original Message -----
From: "Mick Sullivan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 22, 2001 4:07 PM
Subject: Login Handler Question


> 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