基于javaweb+mysql的jsp+servlet网上花店商城系统(java+jsp+servlert+mysql+ajax)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的JSP+Servlet网上花店商城系统(java+jsp+servlert+mysql+ajax)
一、项目简述
功能: 一套完整的网上花店商场系统,系统支持前台会员的注册 登陆系统留言,花朵的品种选择,详情浏览,加入购物 车,购买花朵等;后台支持管理员的花朵种类添加,花朵 详情的添加修改,用户管理,留言管理,商场新闻管理等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP + Servlert + html+ css + JavaScript + JQuery + Ajax + Fileupload等等。
public class ShopAdd2Servlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// es_id NUMBER primary key not null,--id
// es_ep_file_name NVARCHAR2(30),--图片名称
// es_ep_name NVARCHAR2(30),--商品名
// es_ep_price NUMBER,--商品单价
// es_eod_quantity NUMBER,--购买数量
// es_ep_stock NUMBER,--商品库存
// es_ep_id NUMBER,--商品id
// es_EU_USER_ID NVARCHAR2(30),--用户id
// es_valid NUMBER --是否结账,1未结账,2已结账
EASYBUY_PRODUCT p = null;
String pid = req.getParameter("id");
String count = req.getParameter("count");
if(pid!=null){
p = EASYBUY_PRODUCTDao.selectById(Integer.parseInt(pid));
}
resp.setContentType("text/html;charset=utf-8");
PrintWriter out = resp.getWriter();
HttpSession session = req.getSession();
EASYBUY_USER user=(EASYBUY_USER)session.getAttribute("name");
public class SelectProductViewServlet extends HttpServlet {
@SuppressWarnings("unchecked")
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
ArrayList<EASYBUY_PRODUCT_CATEGORY> flist = EASYBUY_PRODUCT_CATEGORYDao.selectFather();
req.setAttribute("flist", flist);
ArrayList<EASYBUY_PRODUCT_CATEGORY> clist = EASYBUY_PRODUCT_CATEGORYDao.selectChild();
req.setAttribute("clist", clist);
String id = req.getParameter("id");
HttpSession session = req.getSession();
//查询最近浏览的商品
ArrayList<Integer> ids = (ArrayList<Integer>)session.getAttribute("ids");
if(ids==null){
ids = new ArrayList<Integer>();
}
if(ids.size()>=5){
ids.remove(0);
}
//System.out.println(!ids.contains(Integer.parseInt(id)));
if(id!=null&&(!ids.contains(Integer.parseInt(id)))){
ids.add(Integer.parseInt(id));
}
session.setAttribute("ids", ids);
ids = (ArrayList<Integer>) session.getAttribute("ids");
if(ids!=null){
ArrayList<EASYBUY_PRODUCT> lastlylist = EASYBUY_PRODUCTDao.selectById(ids);
req.setAttribute("lastlylist", lastlylist);
}
//查询商品
EASYBUY_PRODUCT p = null;
if(id!=null){
p = EASYBUY_PRODUCTDao.selectById(Integer.parseInt(id));
}
public class gmServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest arg0, HttpServletResponse arg1)
throws ServletException, IOException {
arg1.setContentType("text/html;charset=utf-8");
PrintWriter out=arg1.getWriter();
EncodeUtil.encode(arg0);
HttpSession session=arg0.getSession();
EASYBUY_USER list=(EASYBUY_USER)session.getAttribute("name");
//用户id
String id=list.getEU_USER_ID();
//用户姓名
String name=list.getEU_USER_NAME();
//用户地址
String address=list.getEU_ADDRESS();
//总价钱
String price=arg0.getParameter("jstext");
//商品id
String [] EP_ID=arg0.getParameterValues("spID");
//购买数量
String [] quantity=arg0.getParameterValues("number");
//商品单价
String [] sPPrice=arg0.getParameterValues("sPPrice");
//购买后对商品表的库存进行修改
for(int i=0;i<EP_ID.length;i++){
int count5=ESDao.updateStock(Integer.parseInt(quantity[i]),Integer.parseInt(EP_ID[i]));
}
//商品单个总价
int [] pprice=new int[EP_ID.length];
for(int i=0;i<EP_ID.length;i++)