基于javaweb的JSP+Servlet酒店管理系统(java+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

422123080509

432123080509

442123080509

452123080509

462123080509

472123080509

492123080509

基于javaweb的JSP+Servlet酒店管理系统(java+jsp+mysql)

登录:
admin 123456

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
		RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try {
dispatch.forward(request, response);
return;
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

public void init(ServletConfig config) throws ServletException {
super.init(config);
}

public void destroy() {
}
}


public class canzhuoyuding_servlet extends HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String type = req.getParameter("type");
if (type.endsWith("canzhuoyudingMana")) {
canzhuoyudingMana(req, res);
}
if (type.endsWith("canzhuoyudingAdd")) {
canzhuoyudingAdd(req, res);
}
if (type.endsWith("canzhuoyudingDel")) {
canzhuoyudingDel(req, res);
}
}

public void canzhuoyudingAdd(HttpServletRequest req, HttpServletResponse res) {
String shijian = req.getParameter("shijian");
String kehuname = req.getParameter("kehuname");
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


public class kefangleixing_servlet extends HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String type = req.getParameter("type");
if (type.endsWith("kefangleixingMana")) {
kefangleixingMana(req, res);
}
if (type.endsWith("kefangleixingAdd")) {
kefangleixingAdd(req, res);
}
if (type.endsWith("kefangleixingDel")) {
kefangleixingDel(req, res);
}
if (type.endsWith("kefangleixingEdit")) {
kefangleixingEdit(req, res);
}
}

public void kefangleixingMana(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
List kefangleixingList = new ArrayList();
String sql = "select * from t_kefangleixing where del='no'";
Object[] params = new Object[0];
DB mydb = new DB();
try {
mydb.doPstm(sql, params);
ResultSet rs = mydb.getRs();
while (rs.next()) {
List kefangleixing = new ArrayList();
kefangleixing.add(rs.getString("id"));
kefangleixing.add(rs.getString("name"));
kefangleixing.add(rs.getString("beizhu"));
kefangleixing.add(rs.getString("del"));
kefangleixingList.add(kefangleixing);
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
46
			kehu.setYoubian(rs.getString("youbian"));
kehu.setChuanzhen(rs.getString("chuanzhen"));
kehu.setYouxiang(rs.getString("youxiang"));
kehuList.add(kehu);
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed();

req.setAttribute("kehuList", kehuList);
req.getRequestDispatcher("admin/kehu/kehuMana.jsp").forward(req, res);
}

public void kehuXinxi(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
List kehuList = new ArrayList();
String sql = "select * from t_kehu where type='kehu' and id=?";
Object[] params = { Integer.valueOf(Integer.parseInt(req.getParameter("kehu_id"))) };
DB mydb = new DB();
try {
mydb.doPstm(sql, params);
ResultSet rs = mydb.getRs();
while (rs.next()) {
kehu kehu = new kehu();
kehu.setId(rs.getInt("id"));
kehu.setMingcheng(rs.getString("mingcheng"));
kehu.setDizhi(rs.getString("dizhi"));
kehu.setLianxiren(rs.getString("lianxiren"));
kehu.setDianhua(rs.getString("dianhua"));
kehu.setYoubian(rs.getString("youbian"));
kehu.setChuanzhen(rs.getString("chuanzhen"));
kehu.setYouxiang(rs.getString("youxiang"));
kehuList.add(kehu);
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed();

req.setAttribute("kehuList", kehuList);
req.getRequestDispatcher("admin/kehu/kehuXinxi.jsp").forward(req, res);
}

public void kehuEdit(HttpServletRequest req, HttpServletResponse res) {
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
46
47
48
			kehu.setMingcheng(rs.getString("mingcheng"));
kehu.setDizhi(rs.getString("dizhi"));
kehu.setLianxiren(rs.getString("lianxiren"));
kehu.setDianhua(rs.getString("dianhua"));
kehu.setYoubian(rs.getString("youbian"));
kehu.setChuanzhen(rs.getString("chuanzhen"));
kehu.setYouxiang(rs.getString("youxiang"));
kehuList.add(kehu);
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed();

req.setAttribute("kehuList", kehuList);
req.getRequestDispatcher("admin/kehu/kehuMana.jsp").forward(req, res);
}

public void kehuXinxi(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
List kehuList = new ArrayList();
String sql = "select * from t_kehu where type='kehu' and id=?";
Object[] params = { Integer.valueOf(Integer.parseInt(req.getParameter("kehu_id"))) };
DB mydb = new DB();
try {
mydb.doPstm(sql, params);
ResultSet rs = mydb.getRs();
while (rs.next()) {
kehu kehu = new kehu();
kehu.setId(rs.getInt("id"));
kehu.setMingcheng(rs.getString("mingcheng"));
kehu.setDizhi(rs.getString("dizhi"));
kehu.setLianxiren(rs.getString("lianxiren"));
kehu.setDianhua(rs.getString("dianhua"));
kehu.setYoubian(rs.getString("youbian"));
kehu.setChuanzhen(rs.getString("chuanzhen"));
kehu.setYouxiang(rs.getString("youxiang"));
kehuList.add(kehu);
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed();

req.setAttribute("kehuList", kehuList);
req.getRequestDispatcher("admin/kehu/kehuXinxi.jsp").forward(req, res);
}
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
46
47
48
49
50
51
		kefangDel(req, res);
}
}

public void kefangMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
List kefangList = new ArrayList();
String sql = "select * from t_kefang where del='no' order by kefangleixingId";
Object[] params = new Object[0];
DB mydb = new DB();
try {
mydb.doPstm(sql, params);
ResultSet rs = mydb.getRs();
while (rs.next()) {
Kefang kefang = new Kefang();
kefang.setId(rs.getInt("id"));
kefang.setFangjianhao(rs.getString("fangjianhao"));
kefang.setFangjianmianji(rs.getString("fangjianmianji"));
kefang.setFangjianjianjie(rs.getString("fangjianjianjie"));
kefang.setFujian(rs.getString("fujian"));
kefang.setFujianYuanshiming(rs.getString("fujianYuanshiming"));
kefang.setKefangleixingId(rs.getInt("kefangleixingId"));
kefang.setKefangleixingName(liuService.getKefangleixingName(rs.getInt("kefangleixingId")));
kefangList.add(kefang);
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed();

req.setAttribute("kefangList", kefangList);
req.getRequestDispatcher("admin/kefang/kefangMana.jsp").forward(req, res);
}

public void kefangAdd(HttpServletRequest req, HttpServletResponse res) {
String fangjianhao = req.getParameter("fangjianhao");
String fangjianmianji = req.getParameter("fangjianmianji");
String fangjianjianjie = req.getParameter("fangjianjianjie");
String fujian = req.getParameter("fujian");
String fujianYuanshiming = req.getParameter("fujianYuanshiming");
String kefangleixingId = req.getParameter("kefangleixingId");
String del = "no";
String sql = "insert into t_kefang(fangjianhao,fangjianmianji,fangjianjianjie,fujian,fujianYuanshiming,kefangleixingId,del) values(?,?,?,?,?,?,?)";
Object[] params = { fangjianhao, fangjianmianji, fangjianjianjie, fujian, fujianYuanshiming,
Integer.valueOf(Integer.parseInt(kefangleixingId)), del };
DB mydb = new DB();
mydb.doPstm(sql, params);
mydb.closed();

req.setAttribute("message", "操作成功");
req.setAttribute("path", "kefang?type=kefangMana");


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