A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

李志勇:
分页:
jsp->Servlet  传参currPage当前页数
Servlet->jsp  传参currPage当前页数 总记录数 总页数 每页记录数   数据list集合  存入域中  
然后通过一系列判断就能实现
<c:forEach var="i" items="${page.list }" varStatus="stutas">
<tr>
<td>${stutas.count }</td>
<td><input type="checkbox" name="ids"></td>
<td>${i.pname }</td>
<td>${i.market_price }</td>
<td>${i.shop_price }</td>
<td><c:if test="${i.is_hot==1 }">是</c:if><c:if test="${i.is_hot==0 }">否</c:if></td>
<td>${i.pdesc }</td>
<td><c:if test="${i.pflag==1 }">未下架</c:if><c:if test="${i.pflag==0 }">已下架</c:if></td>
<td><a href="${pageContext.request.contextPath }/ProductUpdateServlet?id=${i.pid}">修改</a><a

href="#">删除</a></td>
</tr>
</c:forEach>
<tr>
<td colspan="9"align="center">第${page.currPage }/${page.totalPage }页 &nbsp;&nbsp;共有

${page.totalCount }记录&nbsp;&nbsp;
<c:if test="${page.currPage!=1 }">
<a href="${pageContext.request.contextPath }/ProductPageServlet?currPage=1">[首页]</a>
<a href="${pageContext.request.contextPath }/ProductPageServlet?currPage=${page.currPage-1}">[前一

页]</a>
</c:if>
<c:forEach var="i" begin="1" end="${page.totalPage}">
<c:if test="${i==page.currPage }">${i }</c:if>
<c:if test="${i!=page.currPage }"><a href="${pageContext.request.contextPath }/ProductPageServlet?

currPage=${i }">${i }</a></c:if>
</c:forEach>
<c:if test="${page.currPage!=page.totalPage }">
<a href="${pageContext.request.contextPath }/ProductPageServlet?currPage=${page.currPage+1}">[下一

页]</a>
<a href="${pageContext.request.contextPath }/ProductPageServlet?currPage=${page.totalPage}">[尾页]

</a>
</c:if>
</td>
</tr>
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马