基于javaweb+mysql的jsp+servlet维他茶饮商城系统(java+jdbc+servlet+jsp+mysql)

基于javaweb+mysql的jsp+servlet维他茶饮商城系统(java+jdbc+servlet+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb+mysql的JSP+Servlet维他茶饮商城系统(java+jdbc+servlet+jsp+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、8.0等版本均可;

6.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

技术栈

Servlet、JSP、JDBC、MySQL5.7、Tomcat8

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

  2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

  1. 将项目中com/hr/dao/Basedao.java配置文件中的数据库配置改为自己的配置;

  2. 运行项目,输入localhost:8080/jsp_vtacha_shop

用户账号/密码: user/123456

管理员账号/密码:admin/admin


@WebServlet(name = "admin_order_list",urlPatterns = "/admin/order_list")publicclassAdminOrderListServletextendsHttpServlet {

privateOrderServiceoService=newOrderService();

/**

* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)

*/protectedvoiddoGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

intstatus=0;

if(request.getParameter("status") != null) {

status=Integer.parseInt(request.getParameter("status") ) ;

request.setAttribute("status", status);

intpageNumber=1;

if(request.getParameter("pageNumber") != null) {


@WebServlet(name = "goods_detail",urlPatterns = "/goods_detail")publicclassGoodsDetailServletextendsHttpServlet {

privateGoodsServicegService=newGoodsService();

protectedvoiddoPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

protectedvoiddoGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

intid= Integer.parseInt(request.getParameter("id"));

订单服务层:

@WebServlet(name = "admin_order_list",urlPatterns = "/admin/order_list")publicclassAdminOrderListServletextendsHttpServlet {

privateOrderServiceoService=newOrderService();

/**


request.setAttribute("status", status);

intpageNumber=1;

if(request.getParameter("pageNumber") != null) {

try {

pageNumber=Integer.parseInt(request.getParameter("pageNumber") ) ;

catch (Exception e)

if(pageNumber<=0)

pageNumber=1;

Pagep= oService.getOrderPage(status,pageNumber);

if(p.getTotalPage()==0)


BeanUtils.copyProperties(user, request.getParameterMap());

} catch (IllegalAccessException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (InvocationTargetException e) {

// TODO Auto-generated catch block

e.printStackTrace();

if(uService.register(user)) {

request.setAttribute("msg", "注册成功,请登录!");

request.getRequestDispatcher("user_login.jsp").forward(request, response);

}else {

request.setAttribute("msg", "用户名或邮箱重复,请重新填写!");
intid= Integer.parseInt(request.getParameter("id"));

Goodsg= gService.getGoodsById(id);

request.setAttribute("g", g);

request.getRequestDispatcher("/goods_detail.jsp").forward(request, response);

订单服务层:


/**

* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)

*/protectedvoiddoGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

intstatus=0;

if(request.getParameter("status") != null) {

status=Integer.parseInt(request.getParameter("status") ) ;

request.setAttribute("status", status);

intpageNumber=1;

if(request.getParameter("pageNumber") != null) {

try {

pageNumber=Integer.parseInt(request.getParameter("pageNumber") ) ;

* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)

*/protectedvoiddoGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

intstatus=0;

if(request.getParameter("status") != null) {

status=Integer.parseInt(request.getParameter("status") ) ;

request.setAttribute("status", status);

intpageNumber=1;

if(request.getParameter("pageNumber") != null) {

try {

pageNumber=Integer.parseInt(request.getParameter("pageNumber") ) ;

catch (Exception e)

if(pageNumber<=0)

@WebServlet(name = "user_register",urlPatterns = "/user_rigister")publicclassUserRegisterServletextendsHttpServlet {

privateUserServiceuService=newUserService();

protectedvoiddoPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

Useruser=newUser();

try {

BeanUtils.copyProperties(user, request.getParameterMap());

} catch (IllegalAccessException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (InvocationTargetException e) {

// TODO Auto-generated catch block

e.printStackTrace();

if(uService.register(user)) {

Goodsg= gService.getGoodsById(id);

request.setAttribute("g", g);

request.getRequestDispatcher("/goods_detail.jsp").forward(request, response);

订单服务层:


protectedvoiddoGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

intid= Integer.parseInt(request.getParameter("id"));

Goodsg= gService.getGoodsById(id);

request.setAttribute("g", g);

request.getRequestDispatcher("/goods_detail.jsp").forward(request, response);

订单服务层:


}else {

request.setAttribute("msg", "用户名或邮箱重复,请重新填写!");

request.getRequestDispatcher("user_register.jsp").forward(request, response);

protectedvoiddoGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

用户登录控制层:

@WebServlet(name = "user_login",urlPatterns = "/user_login")publicclassUserLoginServletextendsHttpServlet {

privateUserServiceuService=newUserService();

protectedvoiddoPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

Stringue= request.getParameter("ue");

Stringpassword= request.getParameter("password");

Useruser= uService.login(ue, password);

if(user==null) {

request.setAttribute("failMsg", "用户名、邮箱或者密码错误,请重新登录!");

request.setAttribute("g", g);

request.getRequestDispatcher("/goods_detail.jsp").forward(request, response);

订单服务层:


try {

BeanUtils.copyProperties(user, request.getParameterMap());

} catch (IllegalAccessException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (InvocationTargetException e) {

// TODO Auto-generated catch block

e.printStackTrace();

if(uService.register(user)) {

request.setAttribute("msg", "注册成功,请登录!");

}else {

request.getSession().setAttribute("user", user);

request.getRequestDispatcher("/user_center.jsp").forward(request, response);

protectedvoiddoGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

商品详情控制层:


@WebServlet(name = "goods_detail",urlPatterns = "/goods_detail")publicclassGoodsDetailServletextendsHttpServlet {

privateGoodsServicegService=newGoodsService();

protectedvoiddoPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

protectedvoiddoGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

intid= Integer.parseInt(request.getParameter("id"));

Goodsg= gService.getGoodsById(id);

request.setAttribute("g", g);

request.getRequestDispatcher("/goods_detail.jsp").forward(request, response);

订单服务层:


@WebServlet(name = "admin_order_list",urlPatterns = "/admin/order_list")publicclassAdminOrderListServletextendsHttpServlet {

privateOrderServiceoService=newOrderService();

/**

* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)

*/protectedvoiddoGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

intstatus=0;

请添加图片描述

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值