If I understand correctly, you are needing to move the
JDBC logic from the JSP page, to a JavaBean? This is good practice, as most if not all of your business logic (i.e. interaction with database), should be kept out of the JSP page. It should be rather simple, as long as you understand how to create and use a JavaBean in the web context. Simply make a Java class, called Authenticator for instance, keeping in mind the requirements of a JavaBean (i.e. a constructor with no parameters), and construct a method, authenticate(), which holds the logic to authenticate a user (the DB connection, SQL query, etc.).
So, in essence, all you need do from your JSP page is the following:
This assumes you have something like the following declared in your JSP:
So basically, your Authenticator class with have an authenticate method which accepts two parameters, a username and password, and then builds an SQL query based on these parameters. Hope this helps,
WS
[ March 01, 2004: Message edited by: Winston Smith ]