基于javaweb的JSP+Servlet人事HR管理系统(java+servlet+jsp+jquery+easyui+ztree+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

281023202204

291023202204

301023202204

311023202204

321023202204

331023202204

基于javaweb的JSP+Servlet人事HR管理系统(java+servlet+jsp+jquery+easyui+ztree+mysql)

项目介绍

本项目为基于jsp的HR人事管理系统,可以完美运行。 主要分为超级管理员与普通管理员两种角色; 管理员主要功能包括: 系统管理员:管理员管理、修改密码; 部门信息管理:部门信息添加、部门信息查询; 员工信息管理:新员工登记、员工信息查询; 合同信息管理:合同信息添加、合同信息查询; 考勤信息管理:员工请假信息查询审核、考勤信息添加、考勤信息查询; 工资信息管理:工资信息添加、工资信息查询; 应聘信息管理:应聘信息添加、应聘信息查询; 调职信息管理:调职信息添加、调职信息查询; 离职信息管理:离职信息添加、离职信息查询; 复职信息管理:复职信息添加、复职信息查询; 系统管理; 普通管理员无法对管理员账号信息修改,其它功能类似;

环境需要

1.运行环境:java jdk 1.7;注:本项目目前仅支持jdk 1.7; 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;  5.数据库:MySql 5.7、8.0等版本均可; 6.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

技术栈

  1. 后端:Servlet 2. 前端:JSP+css+javascript+jQuery+easyUI+ztree

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入http://localhost:8080/login.jsp 登录 超级管理员账号密码:hsg/hsg 普通管理员账号密码:ldx/ldx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
        }
if (tzurl.equals("")) {
if (reflush) {
str += "parent.location=parent.location;\n";
} else {
str += "window.location=String(window.location).replace(new RegExp('f=f', 'g'), '');";
}
} else {
str += "location.href='" + tzurl + "';\n";
}

str += "</script>";


PrintWriter wrt = null;
try {
wrt = response.getWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
wrt.write(str);
}

return "";
}

public void delete(HttpServletRequest request, String tablename) {

int i = 0;
try {
String did = request.getParameter("did");
if (did == null) did = request.getParameter("scid");
if (did != null) {
if (did.length() > 0) {
Statement st = conn.createStatement();
System.out.println("delete from " + tablename + " where id=" + did);
st.execute("delete from " + tablename + " where id=" + did);
st.close();
}
}


} catch (SQLException e) {
// TODO Auto-generated catch block
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    }


}



package control;



public class MainCtrl extends HttpServlet {

public MainCtrl() {
super();
}

public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

this.doPost(request, response);
}

/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

StringBuffer sb = new StringBuffer(50);
response.setContentType("application/x-msdownload;charset=GB2312");
try {
response.setHeader("Content-Disposition", new String(sb.toString()
.getBytes(), "ISO8859-1"));
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
            sql1 = "select * from yuangongxinxi where yuangongbianhao='" + username + "' and mima='" + password + "'";
} else {
sql1 = "select * from bumenjingli where bumenbianhao='" + username + "' and mima='" + password + "'";

} else {
sql1 = "select * from allusers where username='" + username + "' and pwd='" + password + "'";
}
}

List<HashMap> userlist1 = dao.select(sql1);
if (userlist1.size() == 1) {
request.getSession().setAttribute("username", userlist1.get(0).get("yuangongbianhao"));
request.getSession().setAttribute("cx", utype);
} else {
request.getSession().setAttribute("username", userlist1.get(0).get("bumenbianhao"));
request.getSession().setAttribute("cx", utype);

} else {
request.getSession().setAttribute("username", userlist1.get(0).get("username"));
request.getSession().setAttribute("cx", userlist1.get(0).get("cx"));
}
}

gor("main.jsp", request, response);
} else {
request.setAttribute("error", "");
go("/login.jsp", request, response);
}
}
}

if (ac.equals("uppass")) {
String olduserpass = request.getParameter("ymm");
String userpass = request.getParameter("xmm1");
String copyuserpass = request.getParameter("xmm2");
HashMap m = dao.getmaps("yonghuming", (String) request.getSession().getAttribute("username"), "yonghuzhuce");
if (!(((String) m.get("mima")).equals(olduserpass))) {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/project?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false&allowPublicKeyRetrieval=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull",
"root", "123456");
}
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}


public int getInt(String sql) {
int i = 0;
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(sql);
if (rs.next()) {
i = rs.getInt(1);
}
st.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return i;
}


public double getDouble(String sql) {
double i = 0;
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(sql);
if (rs.next()) {
i = rs.getDouble(1);

}
st.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    this.request = request;
this.path = path;

request.setAttribute("page", this);

try {
this.currentPage = Integer.parseInt(request
.getParameter("currentPage")) <= 0 ? 1 : Integer
.parseInt(request.getParameter("currentPage"));

} catch (Exception e) {

try {
this.currentPage = Integer.parseInt((String) request
.getSession().getAttribute("currentPage"));

} catch (Exception e1) {
this.currentPage = 1;

}
}
}

/**
*
*/
public static PageManager getPage(String path, int pageSize,
HttpServletRequest request) {
return new PageManager(path, pageSize, request);
}

/**
*
*
*
*/
public void doList(String hql) {

this.count = this.dao.select(hql).size();
if (this.count != 0) {
this.pageNumber = count % this.pageSize == 0 ? this.count


项目链接:
https://javayms.github.io?id=281023292204201ab
https://javayms.pages.dev?id=281023292204201ab