Simple Login Application using JSP, Servlets and JDBC connectivity to MySQL

1 1 1 1 1 1 1 1 1 1 Rating 3.64 (63 Votes)

Requirement

•    Create a Login page to enter user name and password
•    On submit, validate the user name / password against MySQL database
•    If the authentication is successful, forward to home page showing welcome message along with the user name.
•    If the authentication fails, return back to the login page with appropriate error message.
•    If there is exception / errors during authentication process return back to login page with appropriate error message.

Pre-requisites
•    MySQL and Tomcat is already installed
•    You have basic knowledge of MySQL to create tables and insert / update records.
•    You have basic knowledge of Java and J2EE web applications.
•    Have your favorite IDE for developing / reviewing code.

Concepts Covered
•    JDBC connectivity to MySQL from Servlet
•    Simple application of JSTL tag
•    Using session variable in Servlet
•    Polymorphism concept using JDBC
•    Basic error handling concepts

NOTE: Don’t even think of using the code as is for a production environment
This is just for education purpose but you can take inspiration from this code.tongue-out


Checkout our similar article on simple login application using Struts 2 Framework


Joomla SEO by MijoSEF