关于分页的JSTL版本

来源:互联网 发布:软件许可协议文本 编辑:程序博客网 时间:2024/05/21 05:05
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=UTF-8" />    <meta http-equiv="content-language" content="zh-CN" />  <title>订单列表</title><meta name="Keywords" content="订单列表"/><meta name="Description" content="订单列表"/> </head> <body>   <h1>订单列表</h1> <table><tr><th>消费人</th> <th>品名</th> <th>单价</th> <th>数量</th><th>总价</th><th>状态</th> </tr> <c:forEach items="${OrderList.data}" var="vo">   <tr> <td >${vo.userid}</td><td >${vo.name}</td><td >${vo.price}</td><td >${vo.numbers}</td><td >${vo.total}</td><c:if test="${vo.state==1 }"><td style="color:green;">已支付</td></c:if><c:if test="${vo.state==0}"><td style="color:red;">未支付</td></c:if></tr> </c:forEach> <c:if test="${OrderList.sp != null}"><tr><td colspan="6"> <span>共${OrderList.sp.count}条记录</span><span>共${OrderList.sp.totalpage}页</span><span>第${OrderList.sp.page}页</span><span  ><ahref="${pageContext.request.contextPath}/servlets/Order.html?page=${OrderList.sp.firstPage}">首页</a></span><span  ><ahref="${pageContext.request.contextPath}/servlets/Order.html?page=${OrderList.sp.prePage}">上一页</a></span><c:forEach items="${OrderList.sp.arrayPage}" var="index">  <span <c:if test="${index == OrderList.sp.page}">style="color:red;"</c:if> ><a href="${pageContext.request.contextPath}/servlets/Order.html?page=${index}">${index}</a></span> </c:forEach><span  ><ahref="${pageContext.request.contextPath}/servlets/Order.html?page=${OrderList.sp.nextPage}">下一页</a></span><span  ><ahref="${pageContext.request.contextPath}/servlets/Order.html?page=${OrderList.sp.lastPage}">末页</a></span></td></tr></c:if><c:if test="${OrderList.sp == null}"><tr><td colspan="6">目前没有数据!</td></tr></c:if></table> </body></html>

原创粉丝点击