目录
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.