jsp+servlet分页之jsp页面

原创
2015/08/25 11:36
阅读数 53

1.需要分页的jsp页面

<div class="wrapper">
		<%@include file="public/header.jsp"%>
		<div id="page-header">
                              <img src="${pageContext.request.contextPath}/css/business/public/image/                                page-header1.jpg" alt="" />
		</div>
			<a name="hash"></a>
		<div class="section page-content clearfix">
				
			<h2 class="page-title">我的订单</h2>
			<p>
				xxx..xxx
			</p>
			<div class="tag-title-wrap clearfix">
		        <h4 class="tag-title">最近的订单</h4>
		    </div>
		    <table width="100%"  class="account-table">
		    	<c:set var="start" value="${start}" scope="page" />
		    	<c:set var="pagesize" value="5" scope="page" />
		    	<!-- 总记录数 -->
		    	<c:set var="number" value="${count}"></c:set>
		    	 <thead>
			        <tr>
			            <th>订单编号</th>
			            <th>下单日期</th>
			            <th>配送地址</th>
			            <th>总金额</th>
			            <th>订单状态</th>
			            <th>订单明细</th>
			        </tr>
			      </thead>
			         <tbody>
			         <c:choose>
				         <c:when test="${empty list}">
				         	<tr>
				         	<td colspan="6" align="center">暂时没有数据!</td>
				         	</tr>
				         </c:when>
				         <c:otherwise>
					    <c:forEach var="businessOrder" items="${list}">
					      <tr>
					       <td data-title="订单编号">${businessOrder.id}</td>
					       <td data-title="下单日期">${businessOrder.createTime}
					       </td>
					       <td data-title="配送地址">${businessOrder.provinceName}                                                                    ${businessOrder.cityName}
					  ${businessOrder.countiesName} ${businessOrder.address}</td>
				            <td data-title="总金额">${businessOrder.prices}</td>
					    <td data-title="订单状态"> ${businessOrder.stateName}</td>
					    <td data-title="订单明细">
					    <a href="${pageContext.request.contextPath}/business/businessOrderDetail.bus?orderId=${businessOrder.id}" class="button2">明细</a>
					    </td>
					      <tr>
					        </c:forEach>
				        </c:otherwise>
				        
			        </c:choose>
			        </tbody>
		    </table>
		    <div style="width:150px;height: 40px;float: right">
		    	<c:choose>
		    		<c:when test="${ start>0}">
		        		<p style="display: block;margin:0;float: left"><a href="${pageContext.request.contextPath}/business/orderList.bus?start=${start-pagesize}" class="button2">上一页
		        		</a></p>
		        	</c:when>
		        	<c:otherwise>
		        		<p style="display: block;margin:0;float: left">
		        		    <a class="button2" style="color: gray">上一页</a>
		        		</p>
		        	</c:otherwise>
		        </c:choose>
		        
		        <c:choose>
		        <c:when test="${start+pagesize < number}">
		        	<p style="display: block;margin:0;float: right"><a href="${pageContext.request.contextPath}/business/orderList.bus?start=${start+pagesize}" class="button2">下一页</a></p>
		        </c:when>
		        <c:otherwise>
		        	<p style="display: block;margin:0;float: right">
		        	    <a  class="button2" style="color: gray;">下一页</a>
		        	</p>
		        </c:otherwise>
		        </c:choose>
		    </div>
		</div>
	<%@include file="public/foot.jsp" %>
	</div>


展开阅读全文
打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部