——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的JSP+Servlet航班机票预订管理系统(java+servlet+jsp+mysql)
首页:
http://localhost:8080/welcome.html
用户:
机票查询、选座购买、查询已购票、退票等
管理员(admin/123456):
查询售票统计报表
——————————CodeStart——————————
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(); }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 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); }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); }
}
public class Statistics extends HttpServlet { private static final long serialVersionUID = 1L;
|
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); }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); }
}
public class getUserticket extends HttpServlet { private static final long serialVersionUID = 1L;
public getUserticket() { super(); }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 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
|
public getUserticket() { super(); }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 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); }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 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
|
public Jumptouser() { super(); }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 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); }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 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 { 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); }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); }
}
public class Jumptouser extends HttpServlet { private static final long serialVersionUID = 1L;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=101123142409201fu
https://javayms.pages.dev?id=101123142409201fu