Can anybody help me with a javabean code that validates userid and password typed in by the user in a jsp page, against the registered values in a mysql database?

If the username and matching password are correct, the user will be redirected to one jsp page, but if the username and password don't match anything in the mysql database, they will be redirected to an Invalid_login jsp page.