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







基于javaweb的JSP+Servlet电影院售票管理系统(java+servlet+jsp+jdbc+mysql)
项目介绍
这个项目是一个基于Servlet+JSP的电影院售票系统,分为管理员和会员两种角色。
管理员权限包括:
修改登录密码 电影类别管理 电影信息管理 会员信息管理 订单信息管理 留言信息管理
会员权限包括:
会员注册 会员登录 浏览电影 我的购物车 我的订单 留言板
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 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版本; 6.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
技术栈
Servlet、JSP、JDBC、MySQL5.7、Tomcat8
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,然后运行; 3. 将项目中src/com/dao/DB.java配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入localhost:8080/goupiao 管理员账号/密码:admin/admin 会员账号/密码:zhangsan/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
| { String id=String.valueOf(new Date().getTime()); String loginname=req.getParameter("loginname"); String loginpw=req.getParameter("loginpw"); String name=req.getParameter("name"); String del="no"; String s=liuService.panduan_zhanghao(loginname); if(s.equals("yizhan")) { req.setAttribute("message", "账号已被占用,请输入其他账号"); req.setAttribute("path", "site/userreg/userreg.jsp"); String targetURL = "/common/success.jsp"; dispatch(targetURL, req, res); } else { String sql="insert into t_user values(?,?,?,?,?)"; Object[] params={id,loginname,loginpw,name,del}; DB mydb=new DB(); mydb.doPstm(sql, params); mydb.closed(); req.setAttribute("message", "注册成功,请登录"); req.setAttribute("path", "site/default.jsp"); String targetURL = "/common/success.jsp"; dispatch(targetURL, req, res); } }
public void userLogout(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException { HttpSession session=req.getSession(); session.setAttribute("userType", null); session.setAttribute("user", null); req.setAttribute("message", "成功退出系统");
|
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
| catch(Exception e) { e.printStackTrace(); } mydb.closed(); return liuyan; } public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response) { 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() { } } package com.action;
|
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
| { 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() { } } package com.action;
public class user_servlet extends HttpServlet { public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException { String type=req.getParameter("type");
|
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
| } public void init(ServletConfig config) throws ServletException { super.init(config); } public void destroy() { } } package com.action;
public class liuyan_servlet extends HttpServlet { public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException { String type=req.getParameter("type"); if(type.endsWith("liuyanAdd")) { liuyanAdd(req, res); } if(type.endsWith("liuyanMana")) { liuyanMana(req, res); } if(type.endsWith("liuyanDel")) { liuyanDel(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 52
| String sql="insert into t_goods(id,fangyingshi,catelog_id,mingcheng,jieshao,fujian,shichangjia,tejia,del) " + "values(?,?,?,?,?,?,?,?,?)"; Object[] params={id,fangyingshi,catelog_id,mingcheng,jieshao,fujian,shichangjia,tejia,del}; DB mydb=new DB(); mydb.doPstm(sql, params); mydb.closed(); req.setAttribute("msg", "操作成功"); String targetURL = "/common/msg.jsp"; dispatch(targetURL, req, res); }
public void goodsMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException { List goodsList=new ArrayList(); String sql="select * from t_goods where del='no' order by fangyingshi desc"; Object[] params={}; DB mydb=new DB(); try { mydb.doPstm(sql, params); ResultSet rs=mydb.getRs(); while(rs.next()) { Tgoods goods=new Tgoods(); goods.setId(rs.getString("id")); goods.setFangyingshi(rs.getString("fangyingshi")); goods.setCatelog_id(rs.getString("catelog_id")); goods.setMingcheng(rs.getString("mingcheng")); goods.setJieshao(rs.getString("jieshao")); goods.setFujian(rs.getString("fujian")); goods.setShichangjia(rs.getInt("shichangjia")); goods.setTejia(rs.getInt("tejia")); goods.setDel(rs.getString("del")); goodsList.add(goods); } rs.close(); } catch(Exception e) { e.printStackTrace(); } mydb.closed(); req.setAttribute("goodsList", goodsList); req.getRequestDispatcher("admin/goods/goodsMana.jsp").forward(req, res); }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=511122532008200rj
https://javayms.pages.dev?id=511122532008200rj