![]() |
VOOZH | about |
The Employee Management System (EMS) is a Spring Boot web application that manages employee records. It allows adding, updating, deleting individual employees, viewing all employees in a table, and deleting all records after confirmation.
Project contains complete EMS application, including database setup, model, repository, controller and front-end integration with Thymeleaf and Bootstrap.
To follow this tutorial, basic knowledge of the following is required:
Each employee record contains:
Dependencies (build.gradle)
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=ems
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
Employee.java
Annotations:
ConfirmationForm.java
Used for confirming deletion of all employees
EmployeeRepo.java:
The repository extends MongoRepository providing CRUD operations for Employee.
EmployeeController.java: handles HTTP requests and integrates the repository with Thymeleaf views:
The index.html file uses Thymeleaf and Bootstrap to render employee data and forms for CRUD operations. The page includes:
Output screen of Index Page:
π Index Page for Employee Management SystemFor Inserting Employee data into database I used EmployeeRepo object which provides save() methods which is used for saving employee data into database.
Output screen of Insert Employee:
π Insert Employee in DatabaseIf you want to update an employee, you need existing employee ID then we can update employee data other wise not possible. It is a same Inserting data but Before inserting in this method I check if employee id exist or not. If exist I give access to update employee information.
Output screen of Update Employee Details:
π Updating Employee Information in SystemFor Deleting an Employee, we need Employee ID, then only we can be able to delete an existing employee otherwise it's not possible to delete. After Successful delete, the result is updated in Employee table for this I used Thymeleaf for handling the Employee pojo class.
Output screen of Delete Employee:
π Delete Employee from the DatabaseThe Delete All employee's logic is working based on user confirmation. The Confirmation is nothing but while before deleting all data the application asks your confirmation, if you type yes in the given text field means your confirmed to delete all employee's data.
Output Screen of Delete all Employees:
π Delete All Employee Details