商城后台管理系统(一)

更新时间:2023-04-25 04:14:32 阅读: 评论:0


2023年4月25日发(作者:赵向东)

商城后台管理系统(⼀)

后台商品列表展⽰

1.功能截图

2.代码实现

web

package ;

import ption;

import eption;

import ;

import tException;

import rvlet;

impo介绍绿萝 rt rvletRequest;

import rvletRespon;

import t;

import roductListService;

public class AdminProductListServlet extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletRespon respon)

throws ServletException, IOException {

racterEncoding("UTF-8");

tentType("text/html; chart=UTF-8");

AdminProductListService rvice = new AdminProductListService();

List productList = null;

try {

productList = lProduct();

} catch (SQLException e) {

tackTrace();

}

ribute("productList", productList);

uestDispatcher("/admin/product/").forward(request, respon);

}

protected void doPost(HttpServletRequest request, HttpServletRespon respon)

throws ServletException, IOException {

doGet(request, respon);

}

}

rvice

package e;

import eption;

import ;

import roductDao;

import ry;

import t;

public class AdminProductListService {

//商品列表

public List findAllProduct() throws SQLException {

AdminProductDao dao = new AdminProductDao();

List productList = lProduct();

return productList;

}

//增加商品

public void addProduct(Product product) throws SQLException {

AdminProductDao dao = new AdminProductDao();

duct(product);

}

//删除商品

public void delProduct(String pid) throws SQLException {

AdminProductDao dao = new AdminProductDao();

duct(pid);

}

//商品种类

public List findAllCategory() throws SQLException {

AdminProductDao dao = new AdminProductDao();

List categoryList = lCategory();

return categoryList;

}

public Product findProductById(String pid) throws SQLException {

AdminProductDao dao = new AdminProductDao();

Product product = oductById(pid);

return product;

}

}

dao层

packag护士实习总结 e ;

import eption;

import ;

import unner;

import ndler;

import stHandler;

import r职业教育的意义 y;

import t;

import urceUtils;

public class AdminProductDao {

//商品列表

public List findAllProduct() throws SQLException {

QueryRunner qr = new QueryRunner(aSource());

String sql = "le世界最美的风景 ct * from product";

return (sql, new BeanListHandler());

}

//增加商品

public void addProduct(Product product) throws SQLException {

QueryRunner qr = new QueryRunner(aSou代写年终总结 rce());

String sql = "inrt into product values(?,?,?,?,?,?,?,?,?,?)";

(sql, (),me(),ket_price(),p_price(),

age(),te(),_hot(),sc(),ag(),

());

煮大虾怎么煮

}

//删除商品

public void delProduct(String pid) throws SQLException {

QueryRunner qr = new QueryRunner(aSource());

String sql = "delete from product where pid = ?";

(sql, pid);

}

//查询商品种类

public List findAllCategory() throws SQLException {

QueryRunner qr = new QueryRunner(aSource());

String sql = "le昆明周边景点 ct * from category";

List categoryList = (sql, new BeanListHandler());

return categoryList;

}

public Product findProductById(String pid) throws SQLException {

QueryRunner qr = new QueryRunner(aSource());

String sql="lect * from pr敬业的名言 oduct where pid = ?";

Product product = (sql, new Bea砂锅居 nHandler(),pid);

return product;

}

}

这⾥将后续⼏种功能的rvice层和dao层的代码实现都存放在⼀起


本文发布于:2023-04-25 04:14:32,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/513333.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图