0% found this document useful (0 votes)
15 views35 pages

Adbms 9101 Ca2

Uploaded by

amang22cs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views35 pages

Adbms 9101 Ca2

Uploaded by

amang22cs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

MAHATMA EDUCATION SOCIETY’S

PILLAI COLLEGE OF ARTS, COMMERCE & SCIENCE

(Autonomous) NEW PANVEL

PROJECT REPORT ON

“Employee Management System”

IN PARTIAL FULFILLMENT OF

BACHELOR OF COMPUTER SCIENCE

SEMESTER V 2024-25

PROJECT GUIDE

Prof. SHUBANGI MAM

SUBMITTED BY: ABHIJITH CHANDRAN

ROLL NO: 9101


EMPLOYEE MANAGEMENT SYSTEM

• The Employee Management System is a web-based


application designed to streamline the management of
employee information within an organization. This system allows
users to perform various operations related to employee data,
making it a valuable tool for HR departments and management
teams. • Key Features
• User-Friendly Interface:
o The application features a responsive and intuitive user
interface built with Bootstrap, ensuring easy navigation
and a pleasant user experience.
• Employee CRUD Operations:
o Users can perform Create, Read, Update, and Delete
(CRUD) operations on employee records. This includes
adding new employees, viewing existing records, updating
details, and removing employees from the database.
• Database Integration:
o The system is connected to a MySQL database (or Oracle,
depending on your setup) where all employee data is
stored. This ensures data persistence and allows for
efficient data retrieval.

• Session Management:
o The application uses session management to maintain
user states, such as login status and user-specific
messages (e.g., success or error messages).
• Data Validation:
o Input validation is performed to ensure that the data
entered by users meets the required criteria before being
processed and stored in the database.

CODE :

Spring-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:p="http://www.springframework.org/schema/p"

xmlns:tx="http://www.springframework.org/schema/tx"

xmlns:util="http://www.springframework.org/schema/util"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:context="http://www.springframework.org/schema/contex t"

xmlns:mvc="http://www.springframework.org/schema/mvc "

xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/springbeans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/springcontext.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/springmvc.xsd">
<!-- Component scan -->

<context:component-scan base-package="com.becoder" />

<!-- View Resolver -->

<bean name="viewResolver"

class="org.springframework.web.servlet.view.InternalResourceVi
ewResolver">
<property name="prefix" value="/WEB-INF/views/" />

<property name="suffix" value=".jsp" />

</bean>

<tx:annotation-driven/>

<bean name="ds"

class="org.springframework.jdbc.datasource.DriverManagerData
Source">
<property name="driverClassName"
value="com.mysql.cj.jdbc.Driver"/>
<property name="url"
value="jdbc:mysql://localhost:3306/spring_orm"/>
<property name="username" value="root"/>
<property name="password" value="admin"/>
</bean>

<!-- Session Factory Bean -->

<bean name="factory"

class="org.springframework.orm.hibernate5.LocalSessionFactor
yBean">
<property name="dataSource" ref="ds"/>

<property name="hibernateProperties">

<props>

<prop
key="hibernate.dialect">org.hibernate.dialect.MySQL57Dialect</
prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>

<prop key="hibernate.show_sql">true</prop>

<prop key="hibernate.format_sql">true</prop>

<prop key="hibernate.use_sql_comments">true</prop>

</props>

</property>

<property name="annotatedClasses">

<list>
<value>com.becoder.entity.Emp</value>

</list>

</property>

</bean>

<bean name="hibernateTemplate"

class="org.springframework.orm.hibernate5.HibernateTemplate"
>

<property name="sessionFactory" ref="factory"/>

</bean>

<bean name="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactio
nManager">
<property name="sessionFactory" ref="factory"/>

</bean>

</beans>

Home controller.java

package com.becoder.controller;
import
org.springframework.stereotype.C
ontroller; import
org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List; // Correct import for Java List
import com.becoder.dao.EmpDao; import
com.becoder.entity.Emp;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;

@Controller

public class HomeController {

@Autowired private
EmpDao empDao;
@RequestMapping(path = "/home") public String
home(Model m) {

List<Emp> list = empDao.getAllEmp();

m.addAttribute("empList" , list);

return "home"; // This should resolve to


/WEBINF/views/home.jsp
}

@RequestMapping(path = "/addEmp")
public String addEmp() {
return "addEmp"; // This should resolve to /WEB-
INF/views/add_Emp.jsp

@RequestMapping(path = "/createEmp" , method =


RequestMethod.POST)
public String createEmp(@ModelAttribute Emp emp,HttpSession
session) {
System.out.println(emp);
// Ensure empDao is not null if
(empDao == null) {
System.out.println("empDao is null");
return "error"; // Handle error gracefully
}

int i = empDao.saveEmp(emp);

session.setAttribute("msg","Resgister Successfully");

return"redirect:/addEmp";

@RequestMapping(path = "/editEmp/{id}")

public String editEmp(@PathVariable int id,Model m) {

Emp emp =empDao.getEmpById(id);

m.addAttribute("emp",emp);

return "edit_emp";
}

@RequestMapping(path = "/updateEmp" , method =


RequestMethod.POST)
public String updateEmp(@ModelAttribute Emp emp,HttpSession
session) {
empDao.update(emp);

session.setAttribute("msg","Update Succesfully");
return "redirect:/home";
}

@RequestMapping("/deleteEmp/{id}")

public String deleteEmp(@PathVariable int id,HttpSession


session) {
empDao.deleteEmp(id);

session.setAttribute("msg","employee deleted succefully");


return "redirect:/home";
}

Addemp.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"

pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"


%>

<%@page isELIgnored="false"%>
<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Add Employee</title>

<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/boot
strap.min.css" rel="stylesheet" crossorigin="anonymous">
</head>

<body>

<nav class="navbar navbar-expand-lg navbar-dark bg-primary">

<div class="container-fluid">

<a class="navbar-brand" href="#">Employee Management


System</a>

<button class="navbar-toggler" type="button" data-


bstoggle="collapse" data-bs-target="#navbarSupportedContent" aria-
controls="navbarSupportedContent" aria-expanded="false" aria-
label="Toggle navigation">
<span class="navbar-toggler-icon"></span>

</button>

<div class="collapse navbar-collapse"


id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">

<li class="nav-item">

<a class="nav-link active" aria-current="page"


href="home">Home</a>
</li>

<li class="nav-item">

<a class="nav-link" href="addEmp">Add Employee</a>

</li>

</ul>

</div>

</div>

</nav>

<div class="container">

<div class="row">

<div class="col-md-6 offset-md-3">

<div class="card">

<div class="card-header text-center">

<h2>Add Employee</h2>

<c:if test="${not empty msg }">

<h5> ${msg} </h5>


<c:remove var="msg"/>

</c:if>

</div>

<div class="card-body">

<form action="createEmp" method="post">

<div class="mb-3">

<label for="fullname">Enter Full Name</label>

<input type="text" id="fullname" name="fullname"


class="form-control">
</div>

<div class="mb-3">

<label for="address">Enter Address</label>

<input type="text" id="address" name="address" class="form-


control">
</div>

<div class="mb-3">

<label for="email">Enter Email</label>

<input type="text" id="email" name="email"


class="formcontrol">
</div>

<div class="mb-3">

<label for="password">Enter Password</label>


<input type="password" id="password" name="password"
class="form-control">
</div>

<div class="mb-3">

<label for="designation">Enter Designation</label>

<input type="text" id="designation" name="designation"


class="form-control">
</div>

<div class="mb-3">

<label for="salary">Enter Salary</label>

<input type="text" id="salary" name="salary"


class="formcontrol">
</div>

<button type ="submit" class="btn


btnprimary">Submit</button>
</form>

</div>

</div>

</div>

</div>

</div>

<!-- Include Bootstrap JS and Popper.js -->


<script
src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/um
d/popper.min.js" crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstr
ap.min.js" crossorigin="anonymous"></script>
</body>

</html>

Home.jsp

<%@ page language="java" contentType="text/html;


charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@page isELIgnored="false"%>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Employee Management System</title>

<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/boot
strap.min.css" rel="stylesheet" crossorigin="anonymous">
<style>
body {
background-
color: #f8f9fa;
/* Light
background
color */

.card-header {

background-color: #007bff; /* Blue color for header */


color: white; /* White text */
}

.success-message {

color: green; /* Success message color */

.error-message {

color: red; /* Error message color */

</style>

</head>

<body>

<nav class="navbar navbar-expand-lg navbar-dark bg-primary">

<div class="container-fluid">
<a class="navbar-brand" href="#">Employee Management
System</a>

<button class="navbar-toggler" type="button" data-


bstoggle="collapse" data-bs-target="#navbarSupportedContent" aria-
controls="navbarSupportedContent" aria-expanded="false" aria-
label="Toggle navigation">
<span class="navbar-toggler-icon"></span>

</button>

<div class="collapse navbar-collapse"


id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">

<li class="nav-item">

<a class="nav-link active" aria-current="page"


href="home">Home</a>

</li>

<li class="nav-item">

<a class="nav-link" href="addEmp">Add Employee</a>

</li>

</ul>

</div>

</div>

</nav>
<div class="container mt-4">

<div class="row">

<div class="col-md-12">

<div class="card">

<div class="card-header">

<h4>All Employee Details</h4>

<c:if test="${not empty msg }">

<h5 class="success-message">${msg}</h5>

<c:remove var="msg"/>

</c:if>

</div>

<div class="card-body">

<table class="table table-striped">

<thead>

<tr>

<th scope="col">Id</th>

<th scope="col">Full Name</th>

<th scope="col">Address</th>

<th scope="col">Email</th>
<th scope="col">Password</th>

<th scope="col">Designation</th>

<th scope="col">Salary</th>

<th scope="col">Action</th>

</tr>

</thead>

<tbody>

<c:forEach items="${empList}" var="emp">

<tr>

<th scope="row">${emp.id}</th>

<td>${emp.fullname}</td>

<td>${emp.address}</td>

<td>${emp.email}</td>

<td>${emp.password}</td>

<td>${emp.designation}</td>
<td>${emp.salary}</td>

<td>

<a href="editEmp/${emp.id}" class="btn btn-


sm btn-primary">Edit</a>

<a href="deleteEmp/${emp.id}" class="btn


btn-sm btn-danger">Delete</a>
</td>

</tr>

</c:forEach>

</tbody>

</table>

</div>

</div>

</div>

</div>

</div>

<!-- Include Bootstrap JS and Popper.js -->

<script
src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/um
d/popper.min.js" crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstr
ap.min.js" crossorigin="anonymous"></script>
</body>

</html>

Edit_emp.jsp

<%@ page language="java" contentType="text/html;


charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%>

<%@page isELIgnored="false"%>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Add Employee</title>

<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/boot
strap.min.css" rel="stylesheet" crossorigin="anonymous">
</head>

<body>

<nav class="navbar navbar-expand-lg navbar-dark bg-primary">

<div class="container-fluid">

<a class="navbar-brand" href="#">Employee Management


System</a>

<button class="navbar-toggler" type="button" data-


bstoggle="collapse" data-bs-target="#navbarSupportedContent" aria-
controls="navbarSupportedContent" aria-expanded="false" aria-
label="Toggle navigation">
<span class="navbar-toggler-icon"></span>

</button>
<div class="collapse navbar-collapse"
id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">

<li class="nav-item">

<a class="nav-link active" aria-current="page"


href="home">Home</a>
</li>

<li class="nav-item">

<a class="nav-link" href="addEmp">Add Employee</a>

</li>

</ul>

</div>

</div>

</nav>

<div class="container">

<div class="row">

<div class="col-md-6 offset-md-3">

<div class="card">

<div class="card-header text-center">

<h2>Edit Employee</h2>

<c:if test="${not empty msg }">


<h5> ${msg} </h5>

<c:remove var="msg"/>

</c:if>

</div>

<div class="card-body">

<form
action="${pageContext.request.contextPath}/updateEmp"
method="post">
<input type="hidden" name="id" value="${emp.id }">

<div class="mb-3">

<label for="fullname">Enter Full Name</label>

<input type="text" id="fullname" name="fullname"


class="form-control" value="${emp.fullname }">
</div>

<div class="mb-3">

<label for="address">Enter Address</label>

<input type="text" id="address" name="address"


class="form-control" value="${emp.address }">

</div>

<div class="mb-3">

<label for="email">Enter Email</label>


<input type="text" id="email" name="email"
class="formcontrol" value="${emp.email }">
</div>

<div class="mb-3">

<label for="password">Enter Password</label>

<input type="password" id="password" name="password"


class="form-control" value="${emp.password }">
</div>

<div class="mb-3">

<label for="designation">Enter Designation</label>

<input type="text" id="designation" name="designation"


class="form-control" value="${emp.designation }">
</div>

<div class="mb-3">

<label for="salary">Enter Salary</label>

<input type="text" id="salary" name="salary"


class="formcontrol" value="${emp.salary }">

</div>

<button type ="submit" class="btn


btnprimary">Update</button>
</form>

</div>

</div>
</div>

</div>

</div>

<!-- Include Bootstrap JS and Popper.js -->

<script
src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/um
d/popper.min.js" crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstr
ap.min.js" crossorigin="anonymous"></script>
</body>

</html>

Empdaoimpl.java package
com.becoder.dao;
import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;

import com.becoder.entity.Emp;

@Repository

public class EmpDaoImpl implements EmpDao{

@Autowired
private HibernateTemplate hibernateTemplate;

@Transactional

public int saveEmp(Emp emp) {

int i = (Integer) hibernateTemplate.save(emp);

return i;

public Emp getEmpById(int id) {

Emp emp = hibernateTemplate.get(Emp.class,id);

return emp;

public List<Emp> getAllEmp() {

List<Emp> list=hibernateTemplate.loadAll(Emp.class);
return list;
}

@Transactional public void


update(Emp emp) {
hibernateTemplate.update(emp);
}

@Transactional

public void deleteEmp(int id) {


Emp emp = hibernateTemplate.get(Emp.class, id);
hibernateTemplate.delete(emp)
}

Emp.java

package com.becoder.entity;

import javax.persistence.Entity; import


javax.persistence.GeneratedValue; import
javax.persistence.GenerationType; import
javax.persistence.Id; import
javax.persistence.Table;
@Entity

@Table(name = "emp_dtls") public


class Emp {
@Id

@GeneratedValue(strategy = GenerationType.IDENTITY) private


int id;

private String fullname;

private String address;

private String email;

private String password;

private String designation;

private String salary;


public int getId() {

return id;

} public void setId(int id) {

this.id = id;

public String getFullname() {

return fullname;

public void setFullname(String fullname) {


this.fullname = fullname;
}

public String getAddress() {

return address;

public void setAddress(String address) {


this.address = address;
}

public String getEmail() {


return email;

public void setEmail(String email) {


this.email = email;
}

public String getPassword() {

return password;

public void setPassword(String password) {


this.password = password;
}public String getDesignation() { return designation;

} public void setDesignation(String designation) {


this.designation = designation; }

public String getSalary() {


return salary;
}

public void setSalary(String salary) {


this.salary = salary;
}

public String toString() {


return "Emp [id=" + id + ", fullname=" + fullname + ",
address=" + address + ", email=" + email + ", password="

+ password + ", designation=" +


designation + ", salary=" + salary + "]";

Output :

Database output :
PLSQL QUERIES
USE VIEW :
USE FUNCTION :

TO GET THE EMPLOYEE DETAIL WITH THEIR ID.

USE STORED PROCEDURE : TO ADD EMPLOYEE


USE EXCEPTION

TO CHECK EMPLOYEE SALARY GREATER THAN 50000

USE EXPLICIT CURSOR

TO CHECK SALARY MORE THAN 20000.


SWOT analysis for the Employee Management System project:
Strengths
• User-friendly interface: The application features a responsive
and intuitive user interface built with Bootstrap, making it easy
for users to navigate and perform tasks.
• CRUD operations: The system allows users to perform Create,
Read, Update, and Delete operations on employee records,
providing comprehensive management capabilities.
• Database integration: The application is connected to a
MySQL or Oracle database, ensuring data persistence and efficient
retrieval.
• Session management: The system uses session management to
maintain user states, such as login status and user-specific
messages, enhancing the overall user experience.
• Error handling: The application includes comprehensive error
handling to manage exceptions gracefully, improving the overall
stability and reliability of the system.
Weaknesses
• Limited functionality: The current version of the system focuses
on basic CRUD operations and may lack advanced features like
employee performance tracking, attendance management, or
payroll integration.
• Dependency on external libraries: The project relies on several
external libraries and frameworks (e.g., Spring MVC, Hibernate),
which may introduce compatibility issues or require additional
maintenance.
• Lack of user roles and permissions: The system does not
differentiate between user roles (e.g., HR manager, employee)
and their respective permissions, which could lead to security
concerns or unauthorized access to sensitive data.
Opportunities
• Expanding functionality: The project can be extended to
include additional features like employee performance tracking,
attendance management, payroll integration, and reporting,
making it a more comprehensive solution for employee
management.
• Improving user experience: The application can be further
enhanced by incorporating user feedback, improving
navigation, and adding features that streamline common tasks
performed by HR professionals and managers.
• Integrating with other systems: The system can be integrated
with other enterprise applications, such as payroll software or
HR information systems, to create a more seamless and
efficient workflow.
Threats
• Competition from existing solutions: There are several
commercial and open-source employee management systems
available in the market, which may offer more features, better
performance, and larger user communities.
• Security vulnerabilities: If not properly secured, the application
may be susceptible to various security threat.

You might also like