大家好,今天来为大家解答在线订票电影源码分享网站这个问题的一些问题点,包括电影院订票系统源码也一样很多人还不知道,因此呢,今天就来为大家分析分析,现在让我们一起来看看吧!如果解决了您的问题,还望您关注下本站哦,谢谢~
项目介绍
这个项目是一个基于Servlet+JSP的电影院售票系统,分为管理员和会员两种角色。
管理员权限包括:
修改登录密码
电影类别管理
电影信息管理
会员信息管理
订单信息管理
留言信息管理
会员权限包括:
会员注册
会员登录
浏览电影
我的购物车
我的订单
留言板
环境需要
1.运行环境:最好是javajdk1.8,我们是在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat7.x,8.x,9.x版本均可
4.硬件环境:windows7/8/101G内存以上;或者MacOS;
5.数据库:MySql5.7版本;
6.是否Maven项目:否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
技术栈
Servlet、JSP、JDBC、MySQL5.7、Tomcat8
使用说明
1.使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2.使用IDEA/Eclipse/MyEclipse导入项目,然后运行;
3.将项目中src/com/dao/DB.java配置文件中的数据库配置改为自己的配置;
4.运行项目,在浏览器中输入localhost:8080/goupiao
管理员账号/密码:admin/admin
会员账号/密码:zhangsan/123456
用户管理控制层:
publicclassuser_servletextendsHttpServlet\n{\n\t\n\tpublicvoidservice(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\nStringtype=req.getParameter(&34;);\n\t\t\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tuserReg(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tuserLogout(req,res);\n\t\t}\n\t\t\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tuserEditMe(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tuserMana(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tuserDel(req,res);\n\t\t}\n\t}\n\t\n\t\n\tpublicvoiduserReg(HttpServletRequestreq,HttpServletResponseres)\n\t{\n\t\tStringid=String.valueOf(newDate().getTime());\n\t\tStringloginname=req.getParameter(&34;);\n\t\tStringloginpw=req.getParameter(&34;);\n\t\tStringname=req.getParameter(&34;);\n\t\tStringdel=&34;;\n\t\t\n\t\tStrings=liuService.panduan_zhanghao(loginname);\n\t\tif(s.equals(&34;))\n\t\t{\n\t\t\treq.setAttribute(&34;,&34;);\n\t\t\treq.setAttribute(&34;,&34;);\n\t\t\t\n\tStringtargetURL=&34;;\n\t\t\tdispatch(targetURL,req,res);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tStringsql=&34;;\n\t\t\tObject[]params={id,loginname,loginpw,name,del};\n\t\t\tDBmydb=newDB();\n\t\t\tmydb.doPstm(sql,params);\n\t\t\tmydb.closed();\n\t\t\t\n\t\t\treq.setAttribute(&34;,&34;);\n\t\t\treq.setAttribute(&34;,&34;);\n\t\t\t\n\tStringtargetURL=&34;;\n\t\t\tdispatch(targetURL,req,res);\n\t\t}\n\t\t\n\t\t\n\t}\n\t\n\t\n\t\n\tpublicvoiduserLogout(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\n\t\tHttpSessionsession=req.getSession();\n\t\tsession.setAttribute(&34;,null);\n\t\tsession.setAttribute(&34;,null);\n\t\t\n\t\t\t\n\t\treq.setAttribute(&34;,&34;);\n\t\treq.setAttribute(&34;,&34;);\n\t\tStringtargetURL=&34;;\n\t\tdispatch(targetURL,req,res);\n\t}\n\t\n\t\n\tpublicvoiduserEditMe(HttpServletRequestreq,HttpServletResponseres)\n\t{\n\t\tStringid=req.getParameter(&34;);\n\t\tStringloginname=req.getParameter(&34;);\n\t\tStringloginpw=req.getParameter(&34;);\n\t\tStringname=req.getParameter(&34;);\n\t\t\n\t\tStringsql=&34;;\n\t\tObject[]params={loginname,loginpw,name,id};\n\t\tDBmydb=newDB();\n\t\tmydb.doPstm(sql,params);\n\t\tmydb.closed();\n\t\t\n\t\treq.setAttribute(&34;,&34;);\n\t\treq.setAttribute(&34;,&34;);\n\t\t\nStringtargetURL=&34;;\n\t\tdispatch(targetURL,req,res);\n\t\t\n\t}\n\t\n\t\n\tpublicvoiduserMana(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\n\t\tListuserList=newArrayList();\n\t\tStringsql=&39;no&34;;\n\t\tObject[]params={};\n\t\tDBmydb=newDB();\n\t\ttry\n\t\t{\n\t\t\tmydb.doPstm(sql,params);\n\t\t\tResultSetrs=mydb.getRs();\n\t\t\twhile(rs.next())\n\t\t\t{\n\t\t\t\tTuseruser=newTuser();\n\t\t\t\t\n\t\t\t\tuser.setId(rs.getString(&34;));\n\t\t\t\tuser.setLoginname(rs.getString(&34;));\n\t\t\t\tuser.setLoginpw(rs.getString(&34;));\n\t\t\t\tuser.setLoginpw(rs.getString(&34;));\n\t\t\t\tuser.setName(rs.getString(&34;));\n\t\t\t\t\n\t\t\t\tuserList.add(user);\n\t\t}\n\t\t\trs.close();\n\t\t}\n\t\tcatch(Exceptione)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\tmydb.closed();\n\t\t\n\t\treq.setAttribute(&34;,userList);\n\t\treq.getRequestDispatcher(&34;).forward(req,res);\n\t}\n\t\n\t\n\t\n\tpublicvoiduserDel(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\nStringid=req.getParameter(&34;);\n\t\t\n\t\tStringsql=&39;yes&34;;\n\t\tObject[]params={id};\n\t\tDBmydb=newDB();\n\t\tmydb.doPstm(sql,params);\n\t\tmydb.closed();\n\t\t\n\t\treq.setAttribute(&34;,&34;);\n\t\tStringtargetURL=&34;;\n\t\tdispatch(targetURL,req,res);\n\t}\n\t\n\t\n\tpublicvoiddispatch(StringtargetURI,HttpServletRequestrequest,HttpServletResponseresponse)\n\t{\n\t\tRequestDispatcherdispatch=getServletContext().getRequestDispatcher(targetURI);\n\t\ttry\n\t\t{\n\t\tdispatch.forward(request,response);\n\t\treturn;\n\t\t}\n\t\tcatch(ServletExceptione)\n\t\t{\ne.printStackTrace();\n\t\t}\n\t\tcatch(IOExceptione)\n\t\t{\n\t\t\t\n\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublicvoidinit(ServletConfigconfig)throwsServletException\n\t{\n\t\tsuper.init(config);\n\t}\n\t\n\tpublicvoiddestroy()\n\t{\n\t\t\n\t}\n}
订单管理控制层:
publicclassorder_servletextendsHttpServlet\n{\n\tpublicvoidservice(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\nStringtype=req.getParameter(&34;);\n\t\t\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\torderMana(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\torderDel(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\torderShouli(req,res);\n\t\t}\n\t}\n\t\n\tpublicvoidorderMana(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\n\t\tListorderList=newArrayList();\n\t\tStringsql=&34;;\n\t\tObject[]params={};\n\t\tDBmydb=newDB();\n\t\ttry\n\t\t{\n\t\t\tmydb.doPstm(sql,params);\n\t\t\tResultSetrs=mydb.getRs();\n\t\t\twhile(rs.next())\n\t\t\t{\nTorderorder=newTorder();\n\t\t\t\t\n\t\t\t\torder.setId(rs.getString(&34;));\n\t\t\t\torder.setBianhao(rs.getString(&34;));\n\t\t\t\torder.setShijian(rs.getString(&34;));\n\t\t\t\torder.setZhuangtai(rs.getString(&34;));\n\t\t\t\torder.setSonghuodizhi(rs.getString(&34;));\n\t\t\t\torder.setFukuanfangshi(rs.getString(&34;));\n\t\t\t\torder.setJine(rs.getInt(&34;));\n\t\t\t\torder.setUser_id(rs.getString(&34;));\n\t\t\t\t\n\t\t\t\torderList.add(order);\n\t\t}\n\t\t\trs.close();\n\t\t}\n\t\tcatch(Exceptione)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\tmydb.closed();\n\t\t\n\t\treq.setAttribute(&34;,orderList);\n\t\treq.getRequestDispatcher(&34;).forward(req,res);\n\t}\n\t\n\t\n\t\n\tpublicvoidorderDel(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\nStringid=req.getParameter(&34;);\n\t\t\n\t\tStringsql=&34;;\n\t\tObject[]params={id};\n\t\tDBmydb=newDB();\n\t\tmydb.doPstm(sql,params);\n\t\tmydb.closed();\n\t\t\n\t\treq.setAttribute(&34;,&34;);\n\t\tStringtargetURL=&34;;\n\t\tdispatch(targetURL,req,res);\n\t}\n\t\n\t\n\t\n\tpublicvoidorderShouli(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\nStringid=req.getParameter(&34;);\n\t\t\n\t\tStringsql=&39;yes&34;;\n\t\tObject[]params={id};\n\t\tDBmydb=newDB();\n\t\tmydb.doPstm(sql,params);\n\t\tmydb.closed();\n\t\t\n\t\treq.setAttribute(&34;,&34;);\n\t\tStringtargetURL=&34;;\n\t\tdispatch(targetURL,req,res);\n\t}\n\t\n\tpublicvoiddispatch(StringtargetURI,HttpServletRequestrequest,HttpServletResponseresponse)\n\t{\n\t\tRequestDispatcherdispatch=getServletContext().getRequestDispatcher(targetURI);\n\t\ttry\n\t\t{\n\t\tdispatch.forward(request,response);\n\t\treturn;\n\t\t}\n\t\tcatch(ServletExceptione)\n\t\t{\ne.printStackTrace();\n\t\t}\n\t\tcatch(IOExceptione)\n\t\t{\n\t\t\t\n\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublicvoidinit(ServletConfigconfig)throwsServletException\n\t{\n\t\tsuper.init(config);\n\t}\n\t\n\tpublicvoiddestroy()\n\t{\n\t\t\n\t}\n}
商品管理控制层:
publicclassgoods_servletextendsHttpServlet\n{\n\tpublicvoidservice(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\nStringtype=req.getParameter(&34;);\n\t\t\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tgoodsAdd(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tgoodsMana(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tgoodsDel(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tgoodsDetailHou(req,res);\n\t\t}\n\t\t\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tgoodsAll(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tgoodsByCatelog(req,res);\n\t\t}\n\t\tif(type.endsWith(&34;))\n\t\t{\n\t\t\tgoodsDetailQian(req,res);\n\t\t}\n\t}\n\t\n\tpublicvoidgoodsAdd(HttpServletRequestreq,HttpServletResponseres)\n\t{\n\t\tStringid=String.valueOf(newDate().getTime());\n\t\tStringfangyingshi=req.getParameter(&34;);\n\t\tStringcatelog_id=req.getParameter(&34;);\n\t\tStringmingcheng=req.getParameter(&34;);\n\t\t\n\t\tStringjieshao=req.getParameter(&34;);\n\t\tStringfujian=req.getParameter(&34;);\n\t\tintshichangjia=Integer.parseInt(req.getParameter(&34;));\n\t\tinttejia=Integer.parseInt(req.getParameter(&34;));\n\n\n\t\tStringdel=&34;;\n\t\t\n\t\tStringsql=&34;+\n\t\t\t\t&34;;\n\t\tObject[]params={id,fangyingshi,catelog_id,mingcheng,jieshao,fujian,shichangjia,tejia,del};\n\t\tDBmydb=newDB();\n\t\tmydb.doPstm(sql,params);\n\t\tmydb.closed();\n\t\t\n\t\treq.setAttribute(&34;,&34;);\n\t\tStringtargetURL=&34;;\n\t\tdispatch(targetURL,req,res);\n\t}\n\t\n\t\n\tpublicvoidgoodsMana(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\n\t\tListgoodsList=newArrayList();\n\t\tStringsql=&39;no&34;;\n\t\tObject[]params={};\n\t\tDBmydb=newDB();\n\t\ttry\n\t\t{\n\t\t\tmydb.doPstm(sql,params);\n\t\t\tResultSetrs=mydb.getRs();\n\t\t\twhile(rs.next())\n\t\t\t{\n\t\t\t\tTgoodsgoods=newTgoods();\n\t\t\t\t\n\t\t\t\tgoods.setId(rs.getString(&34;));\n\t\t\t\tgoods.setFangyingshi(rs.getString(&34;));\n\t\t\t\tgoods.setCatelog_id(rs.getString(&34;));\n\t\t\t\t\n\t\t\t\tgoods.setMingcheng(rs.getString(&34;));\n\t\t\t\tgoods.setJieshao(rs.getString(&34;));\n\t\t\t\tgoods.setFujian(rs.getString(&34;));\n\t\t\t\t\n\t\t\t\tgoods.setShichangjia(rs.getInt(&34;));\n\t\t\t\tgoods.setTejia(rs.getInt(&34;));\n\t\t\t\tgoods.setDel(rs.getString(&34;));\n\t\t\t\t\n\t\t\t\tgoodsList.add(goods);\n\t\t}\n\t\t\trs.close();\n\t\t}\n\t\tcatch(Exceptione)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\tmydb.closed();\n\t\t\n\t\treq.setAttribute(&34;,goodsList);\n\t\treq.getRequestDispatcher(&34;).forward(req,res);\n\t}\n\t\n\t\n\t\n\tpublicvoidgoodsDel(HttpServletRequestreq,HttpServletResponseres)\n\t{\n\t\tStringid=req.getParameter(&34;);\n\t\tStringsql=&39;yes&34;+id;\n\t\tObject[]params={};\n\t\tDBmydb=newDB();\n\t\tmydb.doPstm(sql,params);\n\t\tmydb.closed();\n\t\t\n\t\treq.setAttribute(&34;,&34;);\n\t\tStringtargetURL=&34;;\n\t\tdispatch(targetURL,req,res);\n\t}\n\t\n\t\n\tpublicvoidgoodsDetailHou(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\nStringid=req.getParameter(&34;);\n\t\t\n\t\treq.setAttribute(&34;,liuService.getGoods(id));\n\t\treq.getRequestDispatcher(&34;).forward(req,res);\n\t}\n\t\n\t\n\tpublicvoidgoodsAll(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\n\t\tListgoodsList=newArrayList();\n\t\t//Stringsql=&39;no&34;;\n\t\tStringsql=&39;no&34;;\n\t\tObject[]params={newSimpleDateFormat(&34;).format(newDate())};\n\t\tDBmydb=newDB();\n\t\ttry\n\t\t{\n\t\t\tmydb.doPstm(sql,null);\n\t\t\tResultSetrs=mydb.getRs();\n\t\t\twhile(rs.next())\n\t\t\t{\n\t\t\t\tTgoodsgoods=newTgoods();\n\t\t\t\t\n\t\t\t\tgoods.setId(rs.getString(&34;));\n\t\t\t\tgoods.setFangyingshi(rs.getString(&34;));\n\t\t\t\tgoods.setCatelog_id(rs.getString(&34;));\n\t\t\t\t\n\t\t\t\tgoods.setMingcheng(rs.getString(&34;));\n\t\t\t\tgoods.setJieshao(rs.getString(&34;));\n\t\t\t\tgoods.setFujian(rs.getString(&34;));\n\t\t\t\t\n\t\t\t\tgoods.setShichangjia(rs.getInt(&34;));\n\t\t\t\tgoods.setTejia(rs.getInt(&34;));\n\t\t\t\tgoods.setDel(rs.getString(&34;));\n\t\t\t\t\n\t\t\t\tgoodsList.add(goods);\n\t\t}\n\t\t\trs.close();\n\t\t}\n\t\tcatch(Exceptione)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\tmydb.closed();\n\t\t\n\t\tif(goodsList.size()>8)\n\t\t{\n\t\t\tgoodsList=goodsList.subList(0,8);\n\t\t}\n\t\t\n\t\treq.setAttribute(&34;,goodsList);\n\t\treq.getRequestDispatcher(&34;).forward(req,res);\n\t}\n\t\n\t\n\t\n\t\n\tpublicvoidgoodsByCatelog(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\nStringcatelog_id=req.getParameter(&34;);\n\t\t\n\t\treq.setAttribute(&34;,liuService.goodsByCatelog(catelog_id));\n\t\treq.getRequestDispatcher(&34;).forward(req,res);\n\t}\n\t\n\tpublicvoidgoodsDetailQian(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException\n\t{\n\t\tStringid=req.getParameter(&34;);\n\t\t\n\t\treq.setAttribute(&34;,liuService.getGoods(id));\n\t\treq.getRequestDispatcher(&34;).forward(req,res);\n\t}\n\t\n\t\n\tpublicvoiddispatch(StringtargetURI,HttpServletRequestrequest,HttpServletResponseresponse)\n\t{\n\t\tRequestDispatcherdispatch=getServletContext().getRequestDispatcher(targetURI);\n\t\ttry\n\t\t{\n\t\tdispatch.forward(request,response);\n\t\treturn;\n\t\t}\n\t\tcatch(ServletExceptione)\n\t\t{\ne.printStackTrace();\n\t\t}\n\t\tcatch(IOExceptione)\n\t\t{\n\t\t\t\n\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublicvoidinit(ServletConfigconfig)throwsServletException\n\t{\n\t\tsuper.init(config);\n\t}\n\t\n\tpublicvoiddestroy()\n\t{\n\t\t\n\t}\n}
原文链接:https://www.tuicool.com/articles/vaaIRnY
在线订票电影源码分享网站和电影院订票系统源码的问题分享结束啦,以上的文章解决了您的问题吗?欢迎您下次再来哦!
