A secure and functional web application demonstrating core backend development with Java Servlets and JSP. This project implements a complete user authentication flow, including registration, login, and session management, connecting to an Oracle database via JDBC. The focus is purely on server-side logic and architecture.
- User Registration: New users can create an account with secure password storage.
- User Login: Existing users can authenticate with their credentials.
- Session Management: User sessions are maintained using
HttpSessionto provide a personalized experience after login. - Database Integration: All user data is persistently stored and retrieved using JDBC to connect to an Oracle SQL database.
- Server-Side Validation: Basic validation is implemented to ensure data integrity.
- Backend: Java, Java Servlets
- Frontend: JSP (JavaServer Pages), HTML, CSS
- Database: Oracle SQL
- Database Connectivity: JDBC (Java Database Connectivity)
- Web Server: Apache Tomcat
- IDE: Eclipse
src/
└── main/
├── java/
│ └── com/
│ ├── login/
│ │ └── LoginServlet.java # Handles user login requests
│ ├── logout/
│ │ └── LogoutServlet.java # Handles user logout and session invalidation
│ ├── registration/
│ │ └── RegistrationServlet.java # Handles new user registration
│ └── util/
│ └── PasswordUtil.java # Utility for password hashing (if implemented)
│
└── webapp/
├── WEB-INF/
│ ├── web.xml # Deployment descriptor (Servlet mappings)
│ └── lib/ # Directory for external JARs (e.g., ojdbc.jar)
├── META-INF/
│ └── context.xml # DataSource configuration (DB connection details)
├── styles/
│ └── style.css # CSS for styling the pages
├── index.jsp # Home page
├── login.jsp # User login form
├── register.jsp # User registration form
└── message.jsp # Page for displaying messages/errors- Java Development Kit (JDK) version 8 or higher.
- Apache Tomcat server (version 9.x or higher).
- Oracle Database installed and running.
- Eclipse IDE for Enterprise Java and Web Developers (optional but recommended).
git clone https://github.com/Shreyash-Sp80/Login-Registration-Backend-Java.gitRun the following SQL commands in your Oracle SQL*Plus or SQL Developer tool to create the table, sequence, and trigger:
CREATE TABLE users (
id INT PRIMARY KEY,
uname VARCHAR2(50),
upwd VARCHAR2(150),
uemail VARCHAR2(50),
umobile VARCHAR2(20)
);
-- Create sequence for auto-incrementing ID
CREATE SEQUENCE users_seq
START WITH 1
INCREMENT BY 1;
-- Create trigger to automatically assign ID from sequence
CREATE OR REPLACE TRIGGER users_bi
BEFORE INSERT ON users
FOR EACH ROW
BEGIN
SELECT users_seq.NEXTVAL
INTO :new.id
FROM dual;
END;
/Prerequisites
- Java Development Kit (JDK) version 8 or higher.
- Apache Tomcat server (version 9.x or higher).
- Oracle Database installed and running.
- Eclipse IDE for Enterprise Java and Web Developers (optional but recommended).
- Copy and paste the following required JAR files into your webapp/WEB-INF/lib/ directory:
- ojdbc14.jar - Oracle JDBC driver for database connectivity
- jbcrypt-0.4.jar - For password encryption (download from: https://repo1.maven.org/maven2/org/mindrot/jbcrypt/0.4/)
- Database Setup Section: Added a dedicated section with your exact SQL commands for creating the
userstable, sequence, and trigger. - Configuration Note: Added a note in the setup steps reminding to place the Oracle JDBC JAR in the
WEB-INF/lib/folder. - Usage Instructions: Updated the registration step to mention the specific fields (
uname,upwd,uemail,umobile) that your table uses.
This README now accurately reflects your project's database schema and provides clear instructions for anyone who wants to set it up.