JavaWeb(购物车部分功能实现)

本文档详细介绍了如何在JavaWeb中实现购物车的各项功能,包括加入购物车、删除商品、修改商品数量及总价,以及实现购物车的分页展示。通过一系列的jsp页面,演示了具体的操作流程和技术实现。
摘要由CSDN通过智能技术生成

目录

1、加入购物车

2、删除商品

3、修改商品(数量和总价)

4、购物车分页


1、加入购物车

index.jsp页面

<%@page import="com.zking.entity.Goods"%>
<%@page import="java.util.List"%>
<%@page import="com.zking.biz.impl.GoodsBizImpl"%>
<%@page import="com.zking.biz.IGoodsBiz"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h3 align="center">购物商城首页</h3>
	<hr />

	<table border="1" width="100%" align="center">
		<tr>
			<th>编号</th>
			<th>名称</th>
			<th>类型</th>
			<th>图片</th>
			<th>价格</th>
			<th>库存</th>
			<th>描述</th>
			<th>操作</th>
		</tr>
		<!-- 
			需求:显示goods表中所有的记录  
		-->
		<%
			//实例化业务逻辑层
			IGoodsBiz igb = new GoodsBizImpl();
			//调用查询所有的方法
			List<Goods> listGoods = igb.queryGoodsAll();
			for (Goods goods : listGoods) {
		%>
		<tr>
			<td><%=goods.getGid()%></td>
			<td><%=goods.getGname()%></td>
			<td><%=goods.getGtype()%></td>
			<td><img style="width: 80px; height: 50px;"
				src="<%=goods.getGimage()%>" /></td>
			<td><%=goods.getGprice()%></td>
			<td><%=goods.getGkc()%></td>
			<td><%=goods.getGinfo()%></td>
			<td><a href="doShopping.jsp?gid=<%=goods.getGid()%>">加入购物车</a></td>
		</tr>
		<%
			}
		%>
	</table>

</body>
</html>

doshopping.jsp页面

<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="com.zking.entity.Cart"%>
<%@page import="com.zking.
  • 13
    点赞
  • 180
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值