Manage. Organize. Simplify.
A Java web application built with Spring MVC, JSP, Hibernate/JPA, and MySQL for managing employee records through an admin interface. It supports employee creation, search, updates, and removal, along with admin signup and login pages.
Employee Management System is a Java-based web application designed to manage employee information through a browser-based interface. The project uses Spring MVC for request handling, JSP for server-rendered pages, Hibernate/JPA for persistence, and MySQL as the relational database.
An administrator can create an account, log in, and access pages for adding, searching, updating, and removing employee records. The application follows a layered structure with Controller, Service, Repository, and Entity packages, making it useful for learning how Spring MVC applications organize request handling and database operations.
The project was developed as an Eclipse/Maven web application. Its current configuration should be reviewed for Java, Spring, Servlet, and Hibernate compatibility before moving to a different runtime or deploying it publicly.
|
|
|
|
Project note: The code includes the above features, but authentication and request protection are not yet consistently enforced across every endpoint. See Known Limitations before using the application with real or sensitive data.
The application uses Spring MVC to route requests to controllers, service classes to coordinate operations, repositories to interact with JPA, and Hibernate to persist entities in MySQL.
ββββββββββββββββββββββββββββββββ
β Browser / JSP UI β
β Login Β· Signup Β· Employee UI β
ββββββββββββββββ¬ββββββββββββββββ
β HTTP Request
βΌ
ββββββββββββββββββββββββββββββββ
β Spring MVC β
β AdminController β
β EmployeeController β
ββββββββββββββββ¬ββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββ
β Service Layer β
β AdminService β
β EmployeeService β
ββββββββββββββββ¬ββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββ
β Repository Layer β
β AdminRepository β
β EmployeeRepository β
ββββββββββββββββ¬ββββββββββββββββ
β JPA / Hibernate
βΌ
ββββββββββββββββββββββββββββββββ
β MySQL β
β Admin and Employee records β
ββββββββββββββββββββββββββββββββ
- Open the application and go to the signup or login page.
- Sign in through the admin login page.
- Open the employee section from the navigation bar.
- Add a new employee or search for an existing employee by ID.
- Update employee details or remove a record as needed.
- Review the success or error message returned by the relevant page.
The source code is arranged into four main application layers:
| Layer | Package / Files | Responsibility |
|---|---|---|
| Controller | Controller/ |
Maps HTTP routes, receives form fields, and selects JSP views |
| Service | Service/ |
Exposes admin and employee operations to controllers |
| Repository | Repository/ |
Uses JPA and Hibernate to persist, query, update, and delete records |
| Entity | Entity/ |
Maps Java classes to database entities |
| Views | WEB-INF/View/ |
Renders login, signup, home, add, search, update, and remove pages |
Spring MVC is configured in dispatcher-servlet.xml, which enables component scanning and annotation-driven request mapping, and resolves view names to JSPs under /WEB-INF/View/.
| Category | Technology / Current Configuration |
|---|---|
| Language | Java (Eclipse project metadata targets Java 21; Maven compiler properties currently specify source/target 8) |
| Web Framework | Spring Web MVC 7.0.8 |
| View Technology | JavaServer Pages (JSP) |
| Persistence | Jakarta Persistence API with Hibernate ORM 6.5.2.Final |
| Database | MySQL |
| Database Driver | MySQL Connector/J 8.4.0 |
| Servlet API | Jakarta Servlet API 6.0.0 (provided scope) |
| Boilerplate Reduction | Lombok 1.18.46 |
| Build Tool | Apache Maven; WAR packaging |
| IDE Metadata | Eclipse Web Tools / Maven integration |
Compatibility note: The checked-in configuration contains a mix of version targets: Maven compiler source/target 8, Eclipse Java facet 21, Spring Framework 7.0.8, and Jakarta Servlet API 6.0.0. This combination should be reviewed and aligned before changing runtimes or relying on a clean deployment. The README documents the repository configuration; it does not claim that every supported runtime combination has been tested.
SpringMVC/
β
βββ pom.xml
βββ .gitignore
βββ .classpath
βββ .project
β
βββ src/
βββ main/
βββ java/
β βββ com/linkcode/SpringMVC/
β βββ app.java
β β
β βββ Controller/
β β βββ AdminController.java
β β βββ EmployeeController.java
β β
β βββ Entity/
β β βββ Admin.java
β β βββ Employee.java
β β
β βββ Repository/
β β βββ AdminRepository.java
β β βββ EmployeeRepository.java
β β
β βββ Service/
β βββ AdminService.java
β βββ EmployeeService.java
β
βββ resources/
β βββ META-INF/
β βββ persistence.xml
β
βββ webapp/
βββ index.jsp
βββ WEB-INF/
βββ dispatcher-servlet.xml
βββ View/
βββ Add.jsp
βββ Home.jsp
βββ Login.jsp
βββ Navbar.jsp
βββ Remove.jsp
βββ Search.jsp
βββ Signup.jsp
βββ Update.jsp
Before running the project, make sure you have:
- JDK installed and configured in Eclipse
- Apache Maven (or Eclipse Maven integration)
- MySQL Server
- Eclipse IDE for Enterprise Java and Web Developers, or another IDE that supports Maven web applications
- A servlet container compatible with the project's Jakarta Servlet dependencies
The exact JDK and server combination should be chosen after resolving the compatibility note above.
git clone https://github.com/TanmayT134/SpringMVC.git
cd SpringMVC- Open Eclipse.
- Select File β Import β Maven β Existing Maven Projects.
- Choose the cloned
SpringMVCfolder. - Finish the import and allow Maven to resolve dependencies.
- Confirm the installed JDK and project facets match your intended runtime.
- Configure a compatible servlet container in the Servers view if you plan to run it from Eclipse.
The persistence unit is named springMVC. Its current JDBC URL is:
jdbc:mysql://localhost:3306/springMVC?createDatabaseIfNotExist=true
In src/main/resources/META-INF/persistence.xml, configure the following properties for your local MySQL installation:
<property name="jakarta.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="jakarta.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/springMVC?createDatabaseIfNotExist=true"/>
<property name="jakarta.persistence.jdbc.user" value="YOUR_MYSQL_USERNAME"/>
<property name="jakarta.persistence.jdbc.password" value="YOUR_MYSQL_PASSWORD"/>Replace the username and password placeholders with your local database credentials. Keep real credentials out of the public repository. The configuration currently sets hibernate.hbm2ddl.auto to update, so Hibernate may update the schema when the application starts.
From the project root, run:
mvn clean packageThe configured Maven build final name is SpringMVC, so the WAR is expected at:
target/SpringMVC.war
If the build fails, first check Maven dependency resolution and the Java/Spring/Servlet compatibility noted above. This command is documented as the project's Maven build path; successful build or deployment has not been verified as part of this README.
Deploy target/SpringMVC.war to a servlet container that is compatible with the resolved dependency versions, or configure the application server in Eclipse and run the project on that server.
The local address is typically:
http://localhost:8080/SpringMVC/
The context path may differ depending on the server configuration. The current index.jsp is a simple Hello World page; use the application's /login or /signup routes to open the admin pages.
The controllers define the following routes:
| Method | Route | Purpose |
|---|---|---|
GET |
/login |
Display the admin login page |
POST |
/login |
Submit admin login credentials |
GET |
/signup |
Display the admin signup page |
POST |
/signup |
Create an admin account |
GET |
/logout |
Invalidate the current session and show login |
GET |
/home |
Open the home page when the expected session attribute is available |
GET / POST |
/add |
Display the add form / create an employee |
GET / POST |
/search |
Display search form / find employee by ID |
GET / POST |
/update |
Display update page / retrieve employee details by ID |
POST |
/updateemp |
Save employee changes |
GET / POST |
/remove |
Display the employee list / remove an employee by ID |
Open these routes relative to the deployed application context, for example /SpringMVC/login.
The Admin entity contains:
idβ generated primary keyusernameβ admin usernamepasswordβ currently stored as a plain string by the application
The Employee entity contains:
idβ generated primary keynameβ employee nameemailβ employee emaildesignationβ employee designationcontactβ contact numbersalaryβ employee salary
Hibernate is configured to create or update mapped tables using hibernate.hbm2ddl.auto=update; no SQL schema file is currently included in the project tree.
This is a learning project that demonstrates Spring MVC request mapping, layered application code, JSP views, and database persistence. It should not be treated as production-ready authentication software in its current form.
- Credentials: Configure your own MySQL username/password in
persistence.xml. Do not commit real credentials to a public repository. - Password storage: The current
Adminentity and repository store and compare passwords as plain strings. Use a password-hashing algorithm before using real user accounts. - Login query: The login repository currently constructs JPQL by concatenating user input. Replace it with a parameterized query to avoid query-injection risks.
- Session consistency: The login controller stores the result list under the
loginsession attribute, while some employee controller methods expect a singleAdminobject. These types should be made consistent and tested. - Endpoint checks: Some employee GET routes check for a session attribute, but the POST handlers do not consistently enforce the same access check. Protect all state-changing operations before exposing the application to untrusted users.
- Session timeout: The current login controller sets a very short session inactive interval. Review it for the intended use case.
- Persistence resources: Repository classes manage static JPA resource fields. Consider request-safe resource handling and proper cleanup/transaction management as the application evolves.
- Compatibility: Align Java compiler settings, Spring Framework, Jakarta Servlet API, and the target server before upgrading or deploying.
These notes describe observed source-level limitations and recommended improvements; they are not claims that those improvements have already been implemented.
Potential next steps for the project include:
- Hash admin passwords
- Use parameterized JPQL queries
- Enforce authentication consistently across all routes
- Add validation for signup and login fields
- Review session timeout and logout behavior
- Add server-side field validation
- Validate email, contact number, and salary values
- Add confirmation before deleting a record
- Improve duplicate and invalid-input handling
- Add pagination and filtering for large employee lists
- Use constructor injection instead of field injection
- Manage EntityManager instances and transactions safely
- Add automated unit and integration tests
- Align Java, Spring, Servlet, and Hibernate versions
- Add database migration scripts
- Add centralized exception handling and logging
- Add employee list sorting and filtering
- Improve responsive layouts and form feedback
- Add a dashboard with employee statistics
- Add pagination and clearer empty-state messages
This project provides practice with:
- Spring MVC controllers and request mappings
- Model-to-view data transfer with
ModelMap - JSP-based server-rendered pages
- Dependency injection and service layers
- Repository-layer database operations
- JPA entities and Hibernate ORM
- MySQL connectivity
- Maven WAR packaging
- Session attributes and request handling
- CRUD implementation in a Java web application
Contributions and suggestions are welcome.
- Fork the repository.
- Create a feature branch.
- Make and test your changes locally.
- Commit your changes with a descriptive message.
- Push your branch and open a Pull Request.
For changes involving authentication, persistence, or dependencies, please include testing steps and note any configuration changes.
Tanmay Tawade
If you find this project useful for learning Spring MVC and Java web development, consider starring the repository or sharing suggestions for improvement.
Employee Management System
Built with Java, Spring MVC, Hibernate/JPA, JSP, and MySQL.
