This project is a User Authentication System built using Java Servlets and JDBC. It provides a simple way to register, login, and manage users in a web application, demonstrating core concepts of Java web development and database connectivity.
- User Registration: Create new accounts via a web form.
- User Login: Authenticate users with username and password.
- Session Management: Maintain user sessions securely.
- Logout Functionality: End user sessions safely.
- Database Integration: Store and retrieve user data using JDBC with a relational database (e.g., MySQL).
- Form Validation: Basic client-side and server-side validation.
- Simple UI: Built with HTML for ease of use and customization.
- Java Servlets
- JDBC (Java Database Connectivity)
- HTML
- MySQL (or another relational database; can be configured)
- Tomcat (or any Servlet container)
-
User Registration:
- Users fill out a registration form.
- The servlet receives the form data, validates it, and inserts a new user record into the database using JDBC.
- If registration is successful, users can proceed to login.
-
User Login:
- Users enter their credentials in the login form.
- The servlet verifies the username and password by querying the database via JDBC.
- On successful authentication, a session is created for the user.
-
Session Management:
- Sessions are used to track logged-in users.
- Protected areas of the application check for a valid session before granting access.
-
Logout:
- Users can log out, which invalidates their session and redirects them to the login page.
-
Database Operations:
- All user data and authentication checks are handled through secure JDBC queries.
- The database typically includes a "users" table with fields for username, password, and other optional details.
-
Front-End Interaction:
- HTML forms are used for registration, login, and navigation.
- Error messages and success notifications are displayed based on servlet responses.
- Java JDK 8 or higher
- Apache Tomcat server
- MySQL database (or compatible relational DB)
- Maven (optional, for dependency management)
-
Clone the repository:
git clone https://github.com/Syeda-Zynab/Servlet_JDBC-User-Authentication-System.git
-
Configure the Database:
- Import the provided SQL script (if available) to create the users table.
- Update your JDBC connection parameters in the source code (
DBConnection.java
or similar).
-
Deploy to Tomcat:
- Build the project (use Maven or IDE).
- Deploy the WAR file or project folder to Tomcat’s
webapps
directory. - Start Tomcat and access the app at
http://localhost:8080/Servlet_JDBC-User-Authentication-System
.
src/
├── main/
│ ├── java/
│ │ └── ... (Servlets, JDBC code)
│ └── webapp/
│ ├── WEB-INF/
│ │ └── web.xml
│ └── ... (HTML pages)
- Update UI in HTML files (
webapp/
directory). - Change JDBC settings for different databases.
- Add additional fields for user registration as needed.
Developed by Syeda-Zynab.