Вы находитесь на странице: 1из 43

JAVA PORJECT REPORT

ON
EMPLOYEE PORTAL

UNIVERSITY INSTITUTE OF ENGINEERING AND TECHNOLOGY


PANJAB UNIVERSITY

SUBMITTED BY:
ANIRUDH AGGARWAL
UE123014
CSE (1), 5th Semester
UIET

ACKNOWLEDGEMENT
Any accomplishment requires the effort of many people & this
work is no different.
I express my Gratitude to Talent Edge for her help, guidance
throughout the work for this project without which I would not
have been able to complete this project to such a success.
I would also like to thank my class mates who helped me directly
or indirectly in accomplishing this work. Finally, I would also like to
thank other faculty members who provided me with Moral support
during the course of this project.
To acknowledge all the persons who had helped for the fulfillment
of the project is not possible for any engineering student.
I would like to give my special thanks to the college UIET, Panjab
University for giving me a chance to do the project based summer
training, from the depth of my heart.
Rest all those people who helped me are not only matter of
acknowledgement but also authorized for sharing the credit.

-ANIRUDH AGGARWAL

ABSTRACT
The following report has been made in accordance with the 6
weeks training to be done by a student doing B.E. in UIET after
the completion of 2nd year during the summer holidays.
Employee Management System is a distributed
application, developed to maintain the details of employees
working in any organization. It maintains the information about
the personal details of their employees, also the details about the
salary and attendance. The application is actually a suite of
applications developed using Java.
It is simple to understand and can be used by anyone who is
not even familiar with simple employees system. It is user friendly
and just asks the user to follow step by step operations by giving
him few options. It is fast and can perform many operations of a
company.
This software package has been developed using the powerful
coding tools of JAVA and HTML at Front End and Oracle Server at
Back End. The software is very user friendly. The package
contains different modules like Employee info. This version of the
software has multi-user approach. For further enhancement or
development of the package, users feedback will be considered.

OBJECTIVES
During the past several decades personnel function has been
transformed from a relatively obscure record keeping staff to
central and top level management function.
There are many factors that have influenced this transformation
like technological advances, professionalism, and general
recognition of human beings as most important resources.
A computer based management system is designed to handle
all the primary information required to manage employee details.
Separate database is maintained to handle all the details required
for the correct salary and attendance generation.
This project intends to introduce more user friendliness in the
various activities such as record updating.
The entire information has maintained in the database or Files
and whoever wants to retrieve cant retrieve, only authorization
user can retrieve the necessary information which can be easily
be accessible from the file. Hence allows for separate
authorization of administrator and employee level users.
The main objective of the entire activity is to automate the
process of day to day activities of a company like:
1.
2.
3.
4.
5.
6.

Admission of a New Employee


Assign account to employee
Assign salary and designation to employee
Check employee attendance
Mark attendance or leave
Updating of employee info

This project have some features:


1. Database connectivity
2. No employee data duplication
3. User friendly environment and performance oriented.

SOFTWARE REQUIREMENT
SPECIFICATION (SRS)
The aim of the system is to develop EMPLOYEE MANAGEMENT
SYSTEM software, which should automate the process to create
and store employee details . The system is supposed to be used
as a subsystem in a large office system, which could be manual
system or a computerized one. Therefore, the proposed system
must be able to function under both circumstances.
The proposed system is not a freeware and due to the usage of
swings, becomes user interactive.
The project demand a page of employee details that include:
Employees personal detail.
Employees salary, designation.

Hardware and software requirements


Hardware Requirements

MEMORY SPACE

Minimum

Recommended HDD -

32 MB

64 MB

To install the software at least

3 GB and the data storage is depending


upon the organizational setup.
PROCESSOR

Dual/Quad

core,

2.5GHZ or above
RAM -

4GB or above

VIDEO

1024x768, 24-bit colors

KEYBOARD

Standard

104

Keys(QWERTY)

Blank writable CD to keep the backup of the Package.


Software Requirements
OPERATING SYSTEM

DEVELOPING LANGUAGE
DATABASE

Windows 7
-

JAVA (jdk-7)

ORACLE

10G

EXPRESS

EDITION
DEVELOPING ENVIRONMENT

Netbeans IDE (Ver.7.1.1)

WEBPAGE DEVELOPMENT -

HTML

TOOLS, PLATFORM AND LANGUAGE


USED:
FRONT END:
The programming has been done using the language Java. It
is Sun Microsystems strategic language for platform independent
programming. It is easy to use, efficient and flexible. This
language is preferred because one can build a program using this
object oriented and platform independent programming with less
effort than with any other programming language. Its a natural
language for building database applications, owing to the level
and sophistication of the tools included with the language.
BACK END:
Oracle Sql Server is one of the leading database
management systems available on the market today. It is easy to
use and administer, and it comes with tools and wizards that
make it easy to develop applications. The database itself has
been redesigned to automatically perform many tuning functions,
leaving you free to focus on most important tasks .

JAVA
Java was conceived by James Gosling, Patrick Naughton, Chris
Warth , Ed Frank ,and Mike Sheridan at Sun Microsystems, Inc. in
1991.It took 18 months to develop the first working version. This
language was initially called Oak but was renamed Java in
1995.
Java has become the language of choice for implementing
Internet-based applications and software for devices that
communicate over a network.
The key that allows Java to solve both the security and the
portability is BYTECODE. It is a highly optimized set of instructions

designed to be executed by the Java run time system, which is


called the Java Virtual Machine (JVM).That is in its standard form,
the JVM is an interpreter for byte code.
Translating a Java program into byte code helps make it much
easier to run a program in a wide variety of environments. The
reason is straight forward : only the JVM needs to be implemented
for each platform.
Java programs consist of pieces called classes. Classes include
pieces called methods that perform tasks and return information
when they complete them. Programmers can create each piece
they need to form Java programs. However, most Java
programmers take advantage of the rich collections of existing
classes in the Java class libraries, which are also known as the
Java APIs ( Application Programming Interfaces).Thus, there are
really two aspects to learning the Java world. The first is the Java
language itself, so that you can program your own classes, and
the second is the classes in the extensive Java class libraries.

Java in Web Development


In terms of web development, Java is frequently used in two
ways. Most commonly Java is used to write server-side web
applications using two technologies: JSPs and servlets. Using Java
in this capacity is a good choice for complex applications, that will
have large numbers(~1000+) of concurrent users, and will be
developed by a team of programmers. Less complex projects,
with fewer concurrent users may have better outcomes when
developed in procedural scripting languages such as PHP or PERL.
The second way in which Java is used, is to create special,
browser embeddable, programs called Applets. While applets had
a brief period of acceptance, their use is becoming increasingly
rare, being replaced by a number of technologies such a Flash

and JavaScript, which are more effective at providing design


enhancements such as animation and rollovers. Using applets for
these purposes is a mistake frequently made by beginning
developers. Still, Applets do have a place in writing specialized
browser-based applications that cannot be accomplished by these
other technologies. Careful consideration should be made before
approving any project that uses Applets.

Origin and Growth


Like many recently developed computer languages, Java borrows
much of its language design from C/C++. For that reason, many
programmers who are proficient in those languages have leaned
Java, and provide a large pool of qualified developers. Java has
gained additional ground as a first language, as it is generally
simpler to master than C++, another commonly used
programming language.

Classes and Objects


Classes
In the real world, you'll often find many individual objects all of
the same kind. There may be thousands of other bicycles in
existence, all of the same make and model. Each bicycle was built
from the same set of blueprints and therefore contains the same
components. In object-oriented terms, we say that your bicycle is
an instance of the class of objects known as bicycles. A class is
the blueprint from which individual objects are created.
Objects
Objects are key to understanding object-oriented technology. Look
around right now and you'll find many examples of real-world
objects: your dog, your desk, your television set, your bicycle.
Real-world objects share two characteristics: They all have state
and behavior. Dogs have state (name, color, breed, hungry) and
behavior (barking, fetching, wagging tail). Bicycles also have
state (current gear, current pedal cadence, current speed) and
behavior (changing gear, changing pedal cadence, applying
brakes). Identifying the state and behavior for real-world objects
is a great way to begin thinking in terms of object-oriented
programming.

Take a minute right now to observe the real-world objects that are
in your immediate area. For each object that you see, ask yourself
two questions: "What possible states can this object be in?" and
"What possible behavior can this object perform?". Make sure to
write down your observations. As you do, you'll notice that realworld objects vary in complexity; your desktop lamp may have
only two possible states (on and off) and two possible behaviors
(turn on, turn off), but your desktop radio might have additional
states (on, off, current volume, current station) and behavior (turn
on, turn off, increase volume, decrease volume, seek, scan, and
tune). You may also notice that some objects, in turn, will also
contain other objects. These real-world observations all translate
into the world of object-oriented programming.
Software objects are conceptually similar to real-world objects:
they too consist of state and related behavior. An object stores its
state in fields (variables in some programming languages) and
exposes its behavior through methods (functions in some
programming languages). Methods operate on an object's internal
state and serve as the primary mechanism for object-to-object
communication. Hiding internal state and requiring all interaction
to be performed through an object's methods is known as data
encapsulation a fundamental principle of object-oriented
programming.
By attributing state (current speed, current pedal cadence, and
current gear) and providing methods for changing that state, the
object remains in control of how the outside world is allowed to
use it. For example, if the bicycle only has 6 gears, a method to
change gears could reject any value that is less than 1 or greater
than 6.
Bundling code into individual software objects provides a number
of benefits, including:
1. Modularity: The source code for an object can be written
and maintained independently of the source code for other

objects. Once created, an object can be easily passed around


inside the system.
2. Information-hiding: By interacting only with an object's
methods, the details of its internal implementation remain
hidden from the outside world.
3. Code re-use: If an object already exists (perhaps written by
another software developer), you can use that object in your
program. This allows specialists to implement/test/debug
complex, task-specific objects, which you can then trust to
run in your own code.
4. Pluggability and debugging ease: If a particular object
turns out to be problematic, you can simply remove it from
your application and plug in a different object as its
replacement. This is analogous to fixing mechanical
problems in the real world. If a bolt breaks, you replace it,
not the entire machine.
Inheritance
Different kinds of objects often have a certain amount in
common with each other. Mountain bikes, road bikes, and tandem
bikes, for example, all share the characteristics of bicycles
(current speed, current pedal cadence, current gear). Yet each
also defines additional features that make them different: tandem
bicycles have two seats and two sets of handlebars; road bikes
have drop handlebars; some mountain bikes have an additional
chain ring, giving them a lower gear ratio.
Object-oriented programming allows classes to inherit commonly
used state and behavior from other classes. For example, Bicycle
becomes the superclass of Mountain-Bike, Road-Bike, and
Tandem-Bike. In the Java programming language, each class is
allowed to have one direct superclass, and each superclass has
the potential for an unlimited number of subclasses.

Interface
As you've already learned, objects define their interaction
with the outside world through the methods that they expose.
Methods form the object's interface with the outside world; the
buttons on the front of your television set, for example, are the
interface between you and the electrical wiring on the other side
of its plastic casing. You press the "power" button to turn the
television on and off.
In its most common form, an interface is a group of related
methods with empty bodies. A bicycle's behavior, if specified as
an interface, might appear as follows:
Implementing an interface allows a class to become more
formal about the behavior it promises to provide. Interfaces form
a contract between the class and the outside world, and this
contract is enforced at build time by the compiler. If your class
claims to implement an interface, all methods defined by that
interface must appear in its source code before the class will
successfully compile.
Package
A package is a namespace that organizes a set of related
classes and interfaces. Conceptually you can think of packages as
being similar to different folders on your computer. You might
keep HTML pages in one folder, images in another, and scripts or
applications in yet another. Because software written in the Java
programming language can be composed of hundreds or
thousands of individual classes, it makes sense to keep things
organized by placing related classes and interfaces into packages.

FORMS LAYOUT
Package logic.
Class Summary
addemp

This class provides code for Addition of Employee


to the Firm

updateinfo

Provides code to view Employee Details and also


to Delete/Modify Accounts

viewdb

Provides the code to show the employees


attendance

salary

Provides code for Salary Slip Generation

attends

Provides code for attendance generation

emplogin/ad Code for welcome screen of employee or


min
administrator

Database Design:

Codes:
addemp:
package logic;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import pp.Emp;

public class addemp extends HttpServlet {

protected void processRequest(HttpServletRequest request,


HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String eid=request.getParameter("t1");
String nm=request.getParameter("t2");
String ps=request.getParameter("t9");
String join=request.getParameter("t3");

String dob=request.getParameter("t4");
String address=request.getParameter("t5");
String city=request.getParameter("t6");
String state=request.getParameter("t7");
String contact=request.getParameter("t8");
long lg=Long.parseLong(contact);
String mail=request.getParameter("t10");
try {
SessionFactory fact= new
Configuration().configure().buildSessionFactory();
Session session=fact.openSession();
Transaction tr=session.beginTransaction();
Emp em=new Emp();
em.setEmpid(eid);
em.setAddress(address);
em.setCity(city);
em.setContact(lg);
em.setDob(dob);
em.setEmail(mail);
em.setJoindate(join);
em.setName(nm);
em.setPassword(ps);
em.setState(state);
session.save(em);
tr.commit();

HttpSession ht=request.getSession();
ht.setAttribute("emid", eid);
response.sendRedirect("salary.jsp");
}finally {
out.close();
}
}

// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click


on the + sign on the left to edit the code.">
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}

Update info:

package logic;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import pp.Emp;

@WebServlet(name = "updateinfo", urlPatterns = {"/addsalary"})


public class updateinfo extends HttpServlet {

protected void processRequest(HttpServletRequest request,


HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
HttpSession ht=request.getSession();
String un=(String)ht.getAttribute("emids");

String nm=request.getParameter("t2");
String ps=request.getParameter("t9");
String join=request.getParameter("t3");
System.out.println("======================anirudh=====");
String dob=request.getParameter("t5");
String address=request.getParameter("t6");
String city=request.getParameter("t7");
String state=request.getParameter("t8");
String contact=request.getParameter("t10");
long lg=Long.parseLong(contact);
String mail=request.getParameter("t11");
try {
SessionFactory fact= new
Configuration().configure().buildSessionFactory();
Session session=fact.openSession();
Transaction tr=session.beginTransaction();
Emp em;
em=(pp.Emp) session.get(pp.Emp.class,un);
System.out.println("=========================anirudh
updates====");
em.setEmpid(un);
em.setAddress(address);
em.setCity(city);
em.setContact(lg);
em.setDob(dob);
em.setEmail(mail);

em.setJoindate(join);
em.setName(nm);
em.setPassword(ps);
em.setState(state);
session.save(em);
tr.commit();
response.sendRedirect("Update Employee.jsp");
}finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click
on the + sign on the left to edit the code.">
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";

}// </editor-fold>
}

salary:
package logic;

import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import pp.Emp;
import pp.Salary;

@WebServlet(name = "addsalary", urlPatterns = {"/addsalary"})


public class addsalary extends HttpServlet {

protected void processRequest(HttpServletRequest request,


HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();

String eid=request.getParameter("t1");
System.out.println("====================anirudh");
String nm=request.getParameter("t2");
System.out.println("====================shivam=====");
String des=request.getParameter("t3");
String salar=request.getParameter("t4");
System.out.println("================="+salar);
Integer sals=Integer.parseInt(salar);
System.out.println("==================="+sals);
try {
System.out.println("=============enter in
try==========");
SessionFactory fact= new
Configuration().configure().buildSessionFactory();
Session session=fact.openSession();
Transaction tr=session.beginTransaction();
System.out.println("======================"+tr);
Salary sal=new Salary();
sal.setEmpid(eid);
sal.setName(nm);
sal.setDesignation(des);
sal.setSalary(sals);
session.save(sal);
tr.commit();
response.sendRedirect("admn area.jsp");
}
catch(Exception e)
{

e.printStackTrace();
}
finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click
on the + sign on the left to edit the code.">
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}

Attends:
package logic;

import java.io.IOException;

import java.io.PrintWriter;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import pp.Attends;
public class attends extends HttpServlet {
protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
HttpSession ht=request.getSession();
String un=(String)ht.getAttribute("emids");
//Long numid= Long.parseLong(un);
System.out.println("u r on profile
page...=========================
Calendar cal = new GregorianCalendar();
int dd = cal.get(Calendar.DATE);
int mon = cal.get(Calendar.MONTH)+1;

"+un);

int yy = cal.get(Calendar.YEAR);
String dat = dd + "-" + mon + "-" + yy;
int hh = cal.get(Calendar.HOUR);
System.out.println("=================="+hh);
int mm = cal.get(Calendar.MINUTE);
String tim = hh + "." + mm ;
System.out.println("==============="+tim);
try {
SessionFactory fact= new
Configuration().configure().buildSessionFactory();
Session sess=fact.openSession();
Transaction tr=sess.beginTransaction();
Attends at=new Attends();
System.out.println("=================== "+at);
at.setEmpid(un);
at.setAdate(dat);
at.setTimein(tim);
sess.save(at);
tr.commit();
sess.close();
//System.out.println("=================================
== "+no);
response.sendRedirect("Attendance week.jsp");
}
catch(Exception ee)
{
ee.printStackTrace();
}

}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click
on the + sign on the left to edit the code.">
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}

Login:
package logic;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class emplogin extends HttpServlet
{
public void service(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String id=request.getParameter("t1");
String pass=request.getParameter("t2");
System.out.println("======================="+id);
System.out.println("==============================="+pa
ss);
try
{
SessionFactory fact= new
Configuration().configure().buildSessionFactory();
Session session=fact.openSession();
Transaction tr=session.beginTransaction();
pp.Emp em;
em=(pp.Emp) session.get(pp.Emp.class,id);
System.out.println("=====hhhhhiiiiiiiiiiii========="+em);
String ids=em.getEmpid();
System.out.println("============="+ids);
String ps=em.getPassword();
System.out.println("============="+ps);

if((id.equals(ids))&&(pass.equals(ps)))
{
HttpSession ht=request.getSession();
ht.setAttribute("emid", id);
response.sendRedirect("EMP AREA.jsp");
}
else
{
response.sendRedirect("sorryemp.jsp");
}
}
finally {
out.close();
}
}
}

SCREENSHOTS

Initial start page for the employee

Employee login screen

Employee welcome screen

Employee personal information screen

Employee mark attendance

Administrator login screen

Administrator welcome screen

New employee creation

Employee salary assignment

Admin attendance screen

Total attendance enteries

CONCLUSION
Since this project has been designed exclusively as a project,
many complexities that can be faced by any real life manual
problem like total no. of employee, address redundancy, updating
problem etc. are considered in this project. Errors are bound to
occur as project has not undergone any rigorous testing. But any
enhancement to the project can easily be made without changing
the current design and programming structure.

Вам также может понравиться