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






基于javaweb的JSP+Servlet在线酒类商城系统(java+jsp+bootstrap+servlet+mysql)
项目介绍
本项目为前后台项目,分为普通用户与管理员两种角色,普通用户登录前台,管理员登录后台;
管理员角色包含以下功能:
管理员登录,会员管理,管理员管理,资讯管理,图片广告管理,商品类别管理,品牌管理,商品管理,库存管理,订单管理,留言管理等功能。
用户角色包含以下功能: 用户首页,登录和注册,收藏商品,查看商品,加入购物车,新增收货地址,提交订单,查看我的订单,资讯查看,留言板等功能。
环境需要
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项目:否;
技术栈
JSP+CSS+JavaScript+jquery+bootstrap+servlet+mysql
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中src/util/SimpleDataSource.java配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/jsp_jiu_buy_online 登录 注:Tomcat中配置项目路径必须为jsp_jiu_buy_online,否则会报异常; 管理员账号/密码:admin/admin 用户账号/密码: user/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
| return ""; } return new String(str.getBytes("ISO-8859-1"),"gb2312"); }
public static String getDay(String date,int day) { String b = date.substring(0,10); String c = b.substring(0,4); String d = b.substring(5,7); String f = b.substring(8,10); String aa = c+"/"+d+"/"+f; String a = ""; DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); GregorianCalendar grc=new GregorianCalendar(); grc.setTime(new Date(aa)); grc.add(GregorianCalendar.DAY_OF_MONTH,day); String resu = dateFormat.format(grc.getTime()); String t[]= resu.split("-"); String sesuu = ""; for(int i=0;i<t.length;i++) { if(t[i].length()==1) { t[i]="0"+t[i]; } sesuu += t[i]+"-"; } return sesuu.substring(0,10); }
|
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
| e.printStackTrace(); }
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); HttpSession session = request.getSession(); HashMap admin = (HashMap) session.getAttribute("admin"); HashMap member = (HashMap) session.getAttribute("member"); String ac = request.getParameter("ac"); if (ac == null) ac = ""; CommDAO dao = new CommDAO(); String date = Info.getDateStr(); String today = date.substring(0, 10); String tomonth = date.substring(0, 7);
if (ac.equals("login")) { String username = request.getParameter("username"); String userpwd = request.getParameter("userpwd"); String sql = "select * from sysuser where username='" + username + "' and userpwd='" + userpwd + "' and usertype in ('管理员') ";
List<HashMap> list = dao.select(sql); if (list.size() == 1) { session.setAttribute("admin", list.get(0)); gor("/jsp_jiu_buy_online/admin/index.jsp", request, response); } else { request.setAttribute("error", ""); go("admin/login.jsp", request, response); } } if (ac.equals("backexit")) { session.removeAttribute("admin"); go("admin/login.jsp", 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 47 48 49 50 51 52 53
| if (fileItem.getName() != null && fileItem.getSize() != 0) { File fullFile = new File(fileItem.getName()); img = Info.generalFileName(fullFile.getName()); File newFile = new File( request.getRealPath("/upfile/") + "/" + img); try { fileItem.write(newFile); } catch (Exception e) { e.printStackTrace(); } } else { } } } String sql = "update news set title='" + title + "',note='" + note + "',img='" + img + "' where id=" + id; dao.commOper(sql); request.setAttribute("suc", "操作成功!"); go("/admin/newslist.jsp?id=" + id, request, response); } catch (Exception e1) { e1.printStackTrace(); request.setAttribute("error", ""); request.getRequestDispatcher("/admin/newsedit.jsp?id=" + id) .forward(request, response); } }
if (ac.equals("noticesadd")) { String title = request.getParameter("title"); String note = request.getParameter("note"); String savetime = Info.getDateStr(); String type = "公告"; dao.commOper("insert into news (title,note,savetime,type) " + " values ('" + title + "','" + note + "','" + savetime + "','" + type + "')"); request.setAttribute("suc", ""); go("admin/noticesadd.jsp", request, response); }
if (ac.equals("noticesedit")) { String id = request.getParameter("id"); String title = request.getParameter("title"); String note = request.getParameter("note"); dao.commOper("update news set title='" + title + "',note='" + note + "' where id=" + id); request.setAttribute("suc", ""); go("admin/noticesedit.jsp?id=" + id, request, response); }
if (ac.equals("yqlinkadd")) { String linkname = request.getParameter("linkname"); String linkurl = request.getParameter("linkurl");
|
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 53
| protected int currentPage;
protected int pageSize;
protected long pageNumber;
protected long count;
protected Collection collection;
protected CommDAO dao = new CommDAO();
protected String info;
protected String path;
protected HttpServletRequest request;
protected String parameter = "";
protected PageManager(String path, int pageSize, HttpServletRequest request) { this.currentPage = 1; this.pageNumber = 1; this.count = 0; this.pageSize = pageSize <= 0 ? DEFAULTPAGESIZE : pageSize; this.request = request; this.path = path;
request.setAttribute("page", this);
try { this.currentPage = Integer.parseInt(request .getParameter("currentPage")) <= 0 ? 1 : Integer
|
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
| protected long pageNumber;
protected long count;
protected Collection collection;
protected CommDAO dao = new CommDAO();
protected String info;
protected String path;
protected HttpServletRequest request;
protected String parameter = "";
protected PageManager(String path, int pageSize, HttpServletRequest request) { this.currentPage = 1; this.pageNumber = 1; this.count = 0; this.pageSize = pageSize <= 0 ? DEFAULTPAGESIZE : pageSize; this.request = request; this.path = path;
request.setAttribute("page", this);
try { this.currentPage = Integer.parseInt(request .getParameter("currentPage")) <= 0 ? 1 : Integer .parseInt(request.getParameter("currentPage"));
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=481122572008200uc
https://javayms.pages.dev?id=481122572008200uc