JSP人事管理系统

更新时间:2024-06-01 16:36:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

基于jsp的企业人事管理系统

毕业设计(论文)资料

设计(论文)题目: 人事OA管理系统

基于jsp的企业人事管理系统

摘 要

随着计算机的普及和计算机科学技术的飞速发展,人们开始越来越多地利用计算机来解决我们生活中的实际问题了。近几年来,由于人力资源制度的不断改革,各级人力资源部门对人力资源信息管理计算机化的需求也与日俱增。因为对大多数的企业管理者而言,如何有效的管理企业的人力资源,使其发挥最大的效益,是每位企业管理者不断面临的难题与挑战。所以企业人力资源成为了企业管理中的重中之重。

以前人力资源甚至还采用人力处理方法,这样不仅效率低下,不易保存和查找,更多的会由于人为的原因,造成数据的遗漏,差错,误报,从而给企业带来重大的损失。因此,开发一个界面友好,功能全面,操作简单的基于B/S(Browser/Server)结构的企业人力资源系统变得十分重要,这也正是本系统开发的目的和意义所在。本系统将采用目前比较先进的MyEclipse6.5开发工具和SQL Server 2005数据库进行设计。

此企业人力资源系统将人力资源与办公自动化管理进行了有机结合,能有效地管理企业内各种人力资源信息,使企业各部门工作人员都能及时,方便地获得所要人员的各种信息,以及对信息的组合条件查询,更新,管理员的密码设置和工资的统计发放等功能,从而提升企业的工作效率和竞争力,满足了现代企业管理的需要。

本系统前台主要使用JSP作为开发语言,后台使用SqlServer作为数据库管理系统,开发环境是MyEclipse,服务器采用tomcat,开发出的一个基于Web技术的B/S结构的人力资源信息管理系统。

关键词:人事管理,JSP,B/S结构

I

基于jsp的企业人事管理系统

ABSTRACT

With the popularity of computer and the computer science and technology rapid development, more and more people began to use computers to solve practical problems in our life. In recent years, because of the personnel system reform and, at all levels of the personnel department personnel information management of computerized demand is growing. Because for the majority of the enterprise managers, how to the effective management of the enterprise personnel, make it play the biggest benefit, is each enterprise managers continuously problems and challenges. So the business enterprise personal management become the enterprise management in the top priority。

Before the personnel management and even human treatment method, it is not only the efficiency is low, is not easy to preserve and find, more will due to human reason, cause the omission of data, mistakes, distorting, thus brings to the enterprise significant loss. Therefore, development of a friendly interface, comprehensive functions, operation simple based on B/S (Browser/Server) structure of the enterprise personnel management system has become very important, and this is the purpose of this system development and its meaning. This system will use at present more advanced MyEclipse6.5 development tools and SQL Server 2005 database design。

The enterprise personnel management system will personnel management and office automation management of organic union, can effectively manage the business enterprise inside various personnel information, make enterprise department staff can timely and easily get to all of the information personnel, and the combination of the conditions of information query, update, and administrator password set and wage statistics distribution function, so as to promote the enterprise work efficiency and competitiveness, and meet the needs of modern enterprise management

The front of the system using JSP as a development language, the use of SqlServer as a database management system, the development environment is MyEclipse, server using tomcat, developed a Web technology based on B / S structure windows management system.

Keywords: Personnel management,JSP,B / S structure

II

基于jsp的企业人事管理系统

目 录

摘 要 .................................................................................................................... I ABSTRACT ......................................................................................................... II 第一章 绪论 ......................................................................................................... 1

1.1课题背景 ....................................................................................................................... 1 1.2目的和意义 ................................................................................................................... 1 1.3开发工具及技术 ........................................................................................................... 1

1.3.1开发工具 ............................................................................................................. 1 1.3.2 JSP ....................................................................................................................... 2 1.3.3 JavaScript ............................................................................................................ 3 1.4软硬件需求 ................................................................................................................... 4

第二章 需求分析 ................................................................................................. 5

2.1需求调研 ....................................................................................................................... 5 2.2可行性分析 ................................................................................................................... 5

2.2.1技术的可行性 ..................................................................................................... 5 2.2.2经济的可行性 ..................................................................................................... 5 2.2.3操作可行性 ......................................................................................................... 6 2.2.4法律的可行性 ..................................................................................................... 6 2.3系统用户用例图 ........................................................................................................... 6

2.3.1管理员用例图 ..................................................................................................... 6 2.4功能模块需求分析 ....................................................................................................... 7 2.5设计的基本思想 ........................................................................................................... 7 2.6性能需求 ....................................................................................................................... 8

2.6.1系统的安全性 ..................................................................................................... 8 2.6.2数据的完整性 ..................................................................................................... 8 2.7界面需求 ....................................................................................................................... 8

第三章 系统分析与设计 ................................................................................... 10

3.1数据库的分析与设计 ................................................................................................. 10

3.1.1数据库的概念结构设计 ................................................................................... 10 3.1.2数据库的逻辑结构设计 ................................................................................... 13 3.1.3数据库的连接原理 ........................................................................................... 15 3.2中文乱码问题处理 ..................................................................................................... 16

第四章 系统功能实现 ....................................................................................... 19

4.1系统登陆页面实现 ..................................................................................................... 19 4.2管理员模块 ................................................................................................................. 22

III

基于jsp的企业人事管理系统

4.2.1部门信息管理 ................................................................................................... 22 4.2.2员工信息管理 ................................................................................................... 27 4.2.3员工工资管理 ................................................................................................... 30 4.2.4员工出勤管理 ................................................................................................... 34 4.2.5员工奖惩管理 ................................................................................................... 37 4.2.6招聘信息管理 ................................................................................................... 40 4.2.7修改个人密码 ................................................................................................... 42 4.2.8退出系统 ........................................................................................................... 43

第五章 系统测试 ............................................................................................... 44

5.1系统测试目的与意义 ................................................................................................. 44 5.2测试过程 ..................................................................................................................... 44

5.2.1主页面的登录模块测试 ................................................................................... 44 5.3其他错误 ..................................................................................................................... 45

结 论 ................................................................................................................. 46 参考文献 ............................................................................................................. 47 致 谢 ................................................................................................................. 48

IV

基于jsp的企业人事管理系统

图中BussinessObject是业务对象,是使用DAO模式的客户端;DataTransferObject数据传输对象,在应用程序不同层次之间传输对象,在一个分布式应用程序中,通常可以提高整理的性能;DataObjectAcces数据输入/输出对象封装了对数据源的一些基本操作;DataSource指的是数据源。可以从图中看出,DAO模式分离了业务逻辑和数据罗即将,是的编写的软件具有良好的层次式体系结构。本系统为了方便数据库的操作,主要使用DBContent的对象来接一个数据库(建立一个类DBContent),代码如下: public DBContent(){

String CLASSFORNAME=\连接数据库的驱动 String url=\

jdbc:microsoft:sqlserver://localhost:1433;databaseName=db_bangong \ String user=\连接数据库的用户名 String password=\连接数据库的密码 try{

Class.forName(CLASSFORNAME);

con= DriverManager.getConnection(url,user,password);//加载数据库的驱动 stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); }

catch(Exception ex){

ex.printStackTrace(); } }

在程序需要连接数据库的地方,只需要生成一个DBConnet的对象,就可以对数据库进行连接并操作。

3.2中文乱码问题处理

在程序中经常会遇到中文乱码的情况,如果手动的在servlet和jsp页面进行设置,相当麻烦。因此,在程序的开始就写了一个过滤器SetCharacterEncodingFilter。

在web.xml中配置:

SetCharacterEncodingFilter

myweb.util.filter.SetCharacterEncodingFilter

encoding gb2312

基于jsp的企业人事管理系统

SetCharacterEncodingFilter

/*//*表示工程下所有的页面都会有此过滤器的处理

对应的SetCharacterEncodingFilter.java文件中的重要代码,在初始化init()方法中定义:

public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig;

this.encoding = filterConfig.getInitParameter(\ String value = filterConfig.getInitParameter(\ }

在工具包util包中同样定义了DataFormate类来处理字符转换: public static String toUni(String gbStr){

String uniStr = \把字符串转换成uincode编码*/ if(gbStr == null){ gbStr = \ } try{

byte[] tempByte = gbStr.getBytes(\ uniStr = new String(tempByte,\ }catch(Exception ex){ }

return uniStr; }

/* 把字符串转换成Utf8编码*/

public static String toUtf8String(String s) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i);

if (c >= 0 && c <= 255) { sb.append(c); } else {

byte[] b; try {

b = Character.toString(c).getBytes(\ }catch (Exception ex) { System.out.println(ex); b = new byte[0]; }

for (int j = 0; j < b.length; j++) { int k = b[j]; if (k < 0) {

基于jsp的企业人事管理系统

k += 256; }

sb.append(\ toUpperCase()); } } return sb.toString(); } }

基于jsp的企业人事管理系统

第四章 系统功能实现

在管理信息系统的生命周期中,仅过了需求分析、系统设计等阶段之后,便开始了系统实施阶段。在系统分析和设计阶段,系统开发工作主要是集中在逻辑、功能和技术设计上,系统实施阶段要继承此前面各个阶段的工作成果,将技术设计转化为物理实现,因此系统实施的成果是系统分析和设计阶段的结晶。

4.1系统登陆页面实现

1.描述:为了保证系统的安全性,要先使用本系统必须先登陆到系统中,并且不同角色的用户进入不同的界面,功能也随之不同。

2.程序运行效果图如图4.1所示:

图4.1 系统登陆页面设计

3.在登陆页面输入用户名和密码以,选择登陆身份后,点击提交按钮,跳转到登陆的service中,在该service中会对用户名,密码,验证码进行判断,并根据相应的用户角色进入对应的页面,loginservice关键代码:

public String login(String userName,String userPw,int userType) {

System.out.println(\ try {

Thread.sleep(700);

} catch (InterruptedException e) {

基于jsp的企业人事管理系统

// TODO Auto-generated catch block e.printStackTrace(); }

String result=\

if(userType==0)//系统管理员登陆 {

String sql=\ Object[] params={userName,userPw}; DB mydb=new DB();

mydb.doPstm(sql, params); try {

ResultSet rs=mydb.getRs();

boolean mark=(rs==null||!rs.next()?false:true); if(mark==false) {

result=\ } else {

result=\

TAdmin admin=new TAdmin();

admin.setUserId(rs.getInt(\

admin.setUserName(rs.getString(\ admin.setUserPw(rs.getString(\ WebContext ctx = WebContextFactory.get(); HttpSession session=ctx.getSession(); session.setAttribute(\ session.setAttribute(\ }

rs.close(); }

catch (SQLException e) {

System.out.println(\登录失败!\ e.printStackTrace(); }

finally {

mydb.closed(); }

基于jsp的企业人事管理系统

}

req.getRequestDispatcher(\

public void orgDel(HttpServletRequest req,HttpServletResponse res) { }

int orgId=Integer.parseInt(req.getParameter(\

String sql=\Object[] params={}; DB mydb=new DB();

mydb.doPstm(sql, params); mydb.closed();

req.setAttribute(\操作成功\req.setAttribute(\

dispatch(targetURL, req, res);

String targetURL = \

4.2.1.3部门信息删除

1.描述:先是点击部门管理,页面跳转到部门管理界面,浏览所有的部门信息,点击要删除的部门,弹出的确定对话框,即可删除该部门信息。

2.程序效果图如下图4.6所示

图4.6 部门信息删除

基于jsp的企业人事管理系统

4.2.2员工信息管理

4.2.2.1员工信息信息录入

1.描述:在此页面主要是输入员工的基本信息,包括姓名、性别、年龄、部门编号、登陆账号、密码等,年龄检验输入是否为数字,是否为空也是通过form表单中的onsubmit=\来检查。

2.程序效果图如图4.7所示:

图4.7员工信息信息录入

4.2.2.2员工信息管理

1.描述:管理员点击左侧的菜单“员工管理”,页面跳转到员工管理界面,调用后台的yuangongServlet类查询出所有的员工信息,并把这些信息封转到数据集合List中,绑定到request对象,然后页面跳转到相应的jsp,显示出员工信息。

2.程序效果图如下图4.8所示

图4.8 员工信息管理页面

员工管理关键代码:

public void yuangongAdd(HttpServletRequest req,HttpServletResponse res)

基于jsp的企业人事管理系统

{

}

int org_id=Integer.parseInt(req.getParameter(\String bianhao=req.getParameter(\String name=req.getParameter(\String sex=req.getParameter(\

String shifoubumenlingdao=req.getParameter(\String loginname=req.getParameter(\String loginpw=req.getParameter(\String del=\

String sql=\Object[]

DB mydb=new DB();

mydb.doPstm(sql, params); mydb.closed();

req.setAttribute(\操作成功\

req.setAttribute(\

dispatch(targetURL, req, res);

params={org_id,bianhao,name,sex,shifoubumenlingdao,loginname,loginpw,del};

String targetURL = \

public void yuangongDel(HttpServletRequest req,HttpServletResponse res) {

int id=Integer.parseInt(req.getParameter(\

String sql=\Object[] params={\DB mydb=new DB();

基于jsp的企业人事管理系统

}

mydb.doPstm(sql, params); mydb.closed();

req.setAttribute(\操作成功\

req.setAttribute(\

dispatch(targetURL, req, res);

String targetURL = \

public void yuangongMana(HttpServletRequest req,HttpServletResponse res) {

List yuangongList=new ArrayList();

String sql=\Object[] params={}; DB mydb=new DB(); try {

mydb.doPstm(sql, params); ResultSet rs=mydb.getRs(); while(rs.next()) {

Yuangong yuangong=new Yuangong();

yuangong.setId(rs.getInt(\

yuangong.setBianhao(rs.getString(\yuangong.setName(rs.getString(\yuangong.setSex(rs.getString(\

throws ServletException, IOException

desc\

基于jsp的企业人事管理系统

yuangong.setShifoubumenlingdao(rs.getString(\

}

catch(Exception e) { }

mydb.closed();

req.setAttribute(\

e.printStackTrace(); }

rs.close();

yuangongList.add(yuangong);

yuangong.setLoginname(rs.getString(\yuangong.setLoginpw(rs.getString(\yuangong.setOrg_id(rs.getInt(\yuangong.setDel(rs.getString(\

yuangong.setOrganization(liuService.getOrg(rs.getInt(\

req.getRequestDispatcher(\}

res);

4.2.3员工工资管理

4.2.3.1工资信息录入

1.描述:在此页面主要是输入员工的工资信息,首先是选择员工,点击“选择按钮”,系统弹出所有的员工信息,供选择,然后输入工资月份、工资金额等信息。

2.程序效果图如图4.7所示:

本文来源:https://www.bwwdw.com/article/mln6.html

Top