A Java-based Leave Management System built using JSP, Servlets, JDBC, MySQL, and JSTL. The application provides separate interfaces for Admins and Employees, enabling efficient leave tracking and management.
- Apply for Casual, Privileged, or Occasional leaves.
- View all leaves applied along with status.
- View remaining leaves by type.
- Constraints:
- Max 25 leaves per year.
- Cannot apply for past dates.
- View all leaves, or filter by Pending, Approved, Rejected.
- Approve or Reject pending leave requests.
- Dashboard shows color-coded status cards for easy navigation.
- Logout functionality.
- User login with role-based access (Admin / Employee).
- Session management using
HttpSession
. - Access restricted to logged-in users only.
- Backend: Java, Servlets, JDBC
- Frontend: JSP, JSTL, Bootstrap 5, HTML, CSS
- Database: MySQL
- Build Tool: Apache Tomcat
- IDE: Eclipse / IntelliJ IDEA
Database: leave_management
- users
CREATE TABLE users (
user_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(100) NOT NULL,
role ENUM('ADMIN', 'EMPLOYEE') NOT NULL
);
- leave_types
CREATE TABLE leave_types (
leave_type_id INT AUTO_INCREMENT PRIMARY KEY,
type_name ENUM('CASUAL', 'PRIVILEGED', 'OCCASIONAL') NOT NULL UNIQUE,
total_allowed INT NOT NULL
);
- leaves
CREATE TABLE leaves (
leave_id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
leave_type_id INT NOT NULL,
start_date DATE NOT NULL,
end_date DATE NOT NULL,
status ENUM('PENDING','APPROVED','REJECTED') DEFAULT 'PENDING',
applied_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(user_id),
FOREIGN KEY (leave_type_id) REFERENCES leave_types(leave_type_id),
CHECK (end_date >= start_date)
);
- Clone the repository
git clone <your-repo-url>
-
Database Setup
- Create MySQL database
leave_management
. - Run the SQL scripts in
database.sql
to create tables and sample data.
- Create MySQL database
-
Configure JDBC Connection
- Update
DBConnection.java
(or your connection class) with your MySQL username and password.
- Update
-
Deploy on Tomcat
- Import project into Eclipse / IntelliJ.
- Add the project to Apache Tomcat server.
- Start server and access via browser:
http://localhost:8080/<project_name>/login.jsp
- Login using Employee credentials.
- Apply for leave by selecting leave type and dates.
- View status of all leaves.
- View remaining leaves.
- Logout.
- Login using Admin credentials.
- Click the leave status cards (All / Pending / Approved / Rejected).
- Approve or Reject pending leaves using action buttons.
- Logout.













- Fork the repository.
- Create a new branch (
git checkout -b feature/feature-name
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/feature-name
). - Open a Pull Request.
This project is open-source and available under the MIT License.
---
If you want, I can also make a **shorter, GitHub-ready README** with **badges, live screenshots, and demo instructions** that looks more professional for your repo.
Do you want me to create that version too?