前台分页功能
运用上次知识点JSTL库实现前台首页分页&模糊查询
<%@page import="com.zking.cart.entity.Users"%>
<%@page import="com.zking.cart.entity.Goods"%>
<%@page import="java.util.List"%>
<%@page import="com.zking.cart.biz.impl.GoodsBizImpl"%>
<%@page import="com.zking.cart.biz.IGoodsBiz"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>购物车主页</title>
<style type="text/css">
h1 {
color: plum
}
</style>
<script type="text/javascript">
function addCart(gid){
location.href = "doShopping.jsp?gid="+gid;
}
</script>
</head>
<body>
<h1 align="center">糖糖购物商城首页</h1>
<hr>
<%
request.setCharacterEncoding("utf-8");
//获取usernmae
String username = request.getParameter("nickname");
if (null != username) {
out.println("<span>欢迎你回来! " + username + "</span>");
} else {
out.println("【<a href = 'Login.jsp'>登录</a>】");
}
%>
<!-- 显示数据时,判断非空 -->
<c:if test="${empty listGoods }">
<jsp:forward page="doLoad.jsp"></jsp:forward>
</c:if>
<div style="text-align: center">
<form action="doLoad.jsp">
名称:<input type="text" name="strName"> <input type="submit"
value="搜索">
</form>
</div>
<br>
<center>
<table border="1" width="70%">
<tr>
<th>商品编号</th>
<th>商品名称</th>
<th>商品价格</th>
<th>商品描述</th>
<th>商品图片</th>
<th>商品操作</th>
</tr>
<c:forEach items="${listGoods }" var="goods">
<tr>
<td>${goods.gid }</td>