项目编号:BS-SC-010
开发工具:IDEA / ECLIPSE
数据库:MYSQL5.7
应用服务器:TOMCAT8.5.31
JDK: 1.8
开发技术:JSP/SERVLET/JDBC
前端页面: css+jquery
本项目主要实现了基于JavaWeb开发而成的一套以图书为主打商品的网上书店商城系统。系统功能完整,页面简洁大方,适合做毕业设计或课程设计使用。
下面展示一下系统的部分功能:
前端页面展示:
首页
商城用户注册
前台用户登陆
添加购物车
结算
查看个人订单
在线留言功能
后台管理系统
用户管理
商品分类管理
商品管理
后台订单管理
修改订单配送状态
留言管理
新闻管理
以上就是展示的本网上图书商城系统的部分功能,系统功能完整,页面简洁大方,适合做毕业设计或课程设计使用。
部分实现代码:
package com.hr.manage;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hr.dao.EASYBUY_COMMENTDao;
import com.hr.entity.EASYBUY_COMMENT;
public class ChaManage extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
ArrayList<EASYBUY_COMMENT> list = EASYBUY_COMMENTDao.selectAll();
//寄包裹
req.setAttribute("list", list);
//转发
req.getRequestDispatcher("guestbook.jsp").forward(req,resp);
}
}
package com.hr.manage;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hr.dao.EASYBUY_COMMENTDao;
public class DelManage extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
int id=Integer.parseInt(request.getParameter("id"));
int num=EASYBUY_COMMENTDao.del(id);
if(num>0){
response.sendRedirect("manage-result.jsp");
//response.getWriter().print("<script>alert('删除成功!');history.back();<script>");
}else{
response.getWriter().print("<script>alert('删除失败!');location.href='SelManage'<script>");
}
}
}
package com.hr.manage;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hr.dao.EASYBUY_COMMENTDao;
import com.hr.entity.EASYBUY_COMMENT;
public class SelManage extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//编码
req.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
int page=1; //当前页数
int pagesize=6;//每页行数
String spage=req.getParameter("page");
if(spage!=null){ //如果页面上传递了页数,将当前页数改变掉
page=Integer.parseInt(spage);
}
//查出总页数
ArrayList<EASYBUY_COMMENT> list=EASYBUY_COMMENTDao.selPage(page, pagesize);
int max_page=EASYBUY_COMMENTDao.getMax(pagesize);
if(list.size()>0&&max_page>0){
req.setAttribute("list", list);
//把总页数传递给guestbook.jsp 使用
req.setAttribute("max_page", max_page);
//把当前页数传递给guestbook.jsp使用
req.setAttribute("page", page);
// 跳
req.getRequestDispatcher("guestbook.jsp").forward(req,resp);
}else{
resp.getWriter().print("还没有留言信息哦!");
}
}
}
package com.hr.manage;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hr.dao.EASYBUY_COMMENTDao;
import com.hr.entity.EASYBUY_COMMENT;
public class UpdateManage extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
int id=Integer.parseInt(request.getParameter("id"));
EASYBUY_COMMENT comment=EASYBUY_COMMENTDao.selOne(id);
if(comment!=null){
request.setAttribute("list",comment);
request.getRequestDispatcher("guestbook-modify.jsp").forward(request, response);
}else{
response.getWriter().print("<script>alert('查询失败!');history.back();</script>");
}
}
}
package com.hr.manage;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hr.dao.EASYBUY_COMMENTDao;
import com.hr.entity.EASYBUY_COMMENT;
public class UpManage extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
int id=Integer.parseInt(request.getParameter("orderId"));
String name=request.getParameter("name");
String replyContent=request.getParameter("replyContent");
String Content=request.getParameter("Content");
Date date=new Date();
System.out.println(Content);
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String replyTime=sdf.format(date);
EASYBUY_COMMENT comment=new EASYBUY_COMMENT(id,Content,replyTime,replyContent,replyTime,name);
//System.out.println(id+"--"+content+"--"+replyTime+"--"+replyContent+"--"+name);
comment.setEC_ID(id);
int num=EASYBUY_COMMENTDao.update(comment);
if(num>0){
response.sendRedirect("manage-result.jsp");
}else{
response.getWriter().print("<script>alert('更新失败!');history.back();</script>");
}
}
}