基于javaweb的JSP+Servlet航班机票预订管理系统(java+servlet+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

111123142409

121123142409

131123142409

151123142409

161123142409

171123142409

基于javaweb的JSP+Servlet航班机票预订管理系统(java+servlet+jsp+mysql)

首页:
http://localhost:8080/welcome.html

用户:
机票查询、选座购买、查询已购票、退票等

管理员(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
38
39
40
41
42
43
44
45
    public writedown() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
String personidnumber = request.getParameter("idnumber");
String flight = request.getParameter("filght");
String theseat = request.getParameter("seats");
String moneys = request.getParameter("moneys");
String seatnumber = request.getParameter("seatnumber");
Recordservice rs = new Recordservice();
rs.recordInformation(personidnumber, flight, theseat, moneys);
rs.changetheplanetime(flight, seatnumber, moneys, theseat);
request.getRequestDispatcher("information.jsp").forward(request, response);
}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}

}




/**
* Servlet implementation class Statistics
*/
public class Statistics extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
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
		request.setAttribute("themoney", takemoney);
request.setAttribute("theflightcode", theflightcode);
request.setAttribute("whichkindofseat", whichkindofseat);
request.setAttribute("whichseat", whichseat);
request.getRequestDispatcher("pay.jsp").forward(request, response);
}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}

}




/**
* Servlet implementation class getUserticket
*/
public class getUserticket extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public getUserticket() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
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
       
/**
* @see HttpServlet#HttpServlet()
*/
public getUserticket() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
int pagesize = Integer.parseInt(request.getParameter("thepagesize"));
int whichpage = Integer.parseInt(request.getParameter("whichpage"));
String idnumber = request.getParameter("theidnumber");
Queryservice qs = new Queryservice();
ArrayList<saledticket> list = qs.selectsaledticket(idnumber, pagesize, whichpage);
request.setAttribute("alist", list);
request.setAttribute("in", idnumber);
request.setAttribute("wp",whichpage);
request.getRequestDispatcher("refund.jsp").forward(request, response);
}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}

}

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
       
/**
* @see HttpServlet#HttpServlet()
*/
public Jumptouser() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
String theflightcode = request.getParameter("theflightcodes");
String whichseat = request.getParameter("sit");
String tempname = "n"+whichseat;
int whichkindofseats = Integer.parseInt(request.getParameter(tempname));
String whichkindofseat;
if(whichkindofseats==1){
whichkindofseat="a";
}else if(whichkindofseats==2){
whichkindofseat="b";
}else{
whichkindofseat="c";
}
float takemoney = Float.parseFloat(request.getParameter("seatype"));
request.setAttribute("themoney", takemoney);
request.setAttribute("theflightcode", theflightcode);
request.setAttribute("whichkindofseat", whichkindofseat);
request.setAttribute("whichseat", whichseat);
request.getRequestDispatcher("pay.jsp").forward(request, response);
}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}

}

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
	 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
String theflightcode=request.getParameter("theflightcode");
String thestartdate=request.getParameter("thestartdate");
Buyservice b = new Buyservice();
ArrayList<planetime> planetimealist = new ArrayList<planetime>();
planetimealist = b.buyselect(theflightcode);
float discount = b.getthediscount(theflightcode, thestartdate);
ArrayList<ArrayList<Integer>> alali = new ArrayList<ArrayList<Integer>>();
alali = b.gettheseat(theflightcode);
request.setAttribute("thediscocunt",discount);
request.setAttribute("theplanetimealist",planetimealist);
request.setAttribute("alal",alali);
request.getRequestDispatcher("buy.jsp").forward(request, response);
}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}

}


/**
* Servlet implementation class Jumptouser
*/
public class Jumptouser extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/


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