分页条件查询页面

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'userPageList.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="${pageContext.request.contextPath }/resources/css/bootstrap.css" rel="stylesheet" />
<!-- 可选的Bootstrap主题文件(一般不用引入) -->
<link href="${pageContext.request.contextPath }/resources/css/bootstrap-theme.css" rel="stylesheet" />
<script src="<c:url value="/resources/js/bootstrap.js" />"></script>
<script src="<c:url value="/resources/js/jquery-1.11.2.js" />"></script>
<style type="text/css">
	#mytable {  
    padding: 0;
    margin: 0;  
    border-collapse:collapse;
}

td {
    border: 1px solid #C1DAD7;  
    background: #fff;
    font-size:11px;
    padding: 6px 6px 6px 12px;
    color: #4f6b72;
}

td.alt {
    background: #F5FAFA;
    color: #797268;
}
</style>
  </head>
  
  <body>
  <a href="#bottom" title="点击跳到bottom">TOP</a>
  <div name="top">TOP</div>
  <br/><br/>
  <div style="position: fixed;left: 600px;bottom: 200px;width: 400px;" name="top">
    <table width="100%" border="0" cellspacing="1" cellpadding="1" id="mytable">
    	<tr>
    		<td colspan="3">
    			<form action="${pageContext.request.contextPath }/userPage" method="post"> 
    				用户id:<input type="text" name="userId" value="${view.userId }">    用户名:<input type="text" name="userName" value="${view.userName }"/>
    				<input type="submit" value="查询" />
    			</form> 
    		</td>
    	</tr>
    	<tr>
    		<td colspan="3">
    			共${page.totalCount }记录,当前第${page.currentPageNum }/${page.totalPageNum }页。
    		</td>
    	</tr>
    	<tr>
    		<td colspan="3">
    			<form action="${pageContext.request.contextPath }/userPage?currentPageNum=1" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="首页"/>
    			</form>
    			
    			<c:choose>
    				<c:when test="${page.currentPageNum+1 gt page.totalPageNum}">
    			<form action="${pageContext.request.contextPath }/userPage?currentPageNum=${page.totalPageNum}" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="下一页"/>
    			</form>
    				</c:when>
    			<c:otherwise>
    			<form action="${pageContext.request.contextPath }/userPage?currentPageNum=${page.currentPageNum+1}" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="下一页"/>
    			</form>
    			</c:otherwise>
    			</c:choose>    
    			<form action="${pageContext.request.contextPath }/userPage?currentPageNum=${page.currentPageNum-1}" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="上一页"/>
    			</form>
    			<form action="${pageContext.request.contextPath }/userPage?currentPageNum=${page.totalPageNum}" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="尾页"/>
    			</form>
    			 
    		</td>
    	</tr>
    	<tr>
    		<td>userId</td>
    		<td>userName</td>
    		<td>操作</td>
    	</tr>
    	<c:forEach items="${page.entitys }" var="user">
    		<tr>
    			<td>${user.userId }</td>
    			<td>${user.userName }</td>
    			<td>
    				<a >修改</a>
    				<a>删除</a>
    			</td>
    		</tr>
    	</c:forEach>
    	<tr>
    		<td colspan="3">
    			<ul class="pagination pagination-sm">
  				  <li><a href="#">«</a></li>
				  <li class="active"><a href="${pageContext.request.contextPath }/userPage?currentPageNum=1">1</a></li>
				  <li><a href="#" οnclick="">2</a></li>
				  <li><a href="#">3</a></li>
				  <li><a href="#">4</a></li>
				  <li><a href="#">5</a></li>
				  <li class="disabled"><a href="#" >»</a></li>
				  </ul><br/>
    		</td>
    	</tr>
    </table>
    </div>
    
    <br/><br/><br/> <br/><br/><br/>
 <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/> 
    <br/><br/><br/> <br/><br/><br/>
 <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/> 
    <br/><br/><br/> <br/><br/><br/>
 <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/> 
 
 <div name="bottom" id="bottom">BOTTOM</div>
 <a href="#top" title="点击跳到top">BOTTOM</a>
  </body>
</html>

第二个页面

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'userPageList.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="${pageContext.request.contextPath }/resources/css/bootstrap.css" rel="stylesheet" />
<!-- 可选的Bootstrap主题文件(一般不用引入) -->
<link href="${pageContext.request.contextPath }/resources/css/bootstrap-theme.css" rel="stylesheet" />
<script src="<c:url value="/resources/js/bootstrap.js" />"></script>
<script src="<c:url value="/resources/js/jquery-1.11.2.js" />"></script>
<style type="text/css">
	#mytable {  
    padding: 0;
    margin: 0;  
    border-collapse:collapse;
}

td {
    border: 1px solid #C1DAD7;  
    background: #fff;
    font-size:11px;
    padding: 6px 6px 6px 12px;
    color: #4f6b72;
}

td.alt {
    background: #F5FAFA;
    color: #797268;
}
.noShow{
	display: none;
}
</style>
  </head>
  
  <body>
  <a href="#bottom" title="点击跳到bottom">TOP</a>
  <div name="top">TOP</div>
  <br/><br/>
  <div style="position: fixed;left: 600px;bottom: 200px;width: 400px;" name="top">
    <table width="100%" border="0" cellspacing="1" cellpadding="1" id="mytable">
    	<tr>
    		<td colspan="3">
    			<form action="${pageContext.request.contextPath }/userPage" method="post"> 
    				用户id:<input type="text" name="userId" value="${view.userId }">    用户名:<input type="text" name="userName" value="${view.userName }"/>
    				<input type="submit" value="查询" />
    			</form> 
    		</td>
    	</tr>
    	<tr>
    		<td colspan="3">
    			共${page.totalCount }记录,当前第${page.currentPageNum }/${page.totalPageNum }页。
    		</td>
    	</tr>
    	
    	<tr>
    		<td>userId</td>
    		<td>userName</td>
    		<td>操作</td>
    	</tr>
    	<c:forEach items="${page.entitys }" var="user">
    		<tr>
    			<td>${user.userId }</td>
    			<td>${user.userName }</td>
    			<td>
    				<a >修改</a>
    				<a>删除</a>
    			</td>
    		</tr>
    	</c:forEach>
    	<tr>
    		<td colspan="3">
    			<ul class="pagination pagination-sm">
  				  <li><a href="#">«</a></li>
				  <li class="active"><a href="${pageContext.request.contextPath }/userPage?currentPageNum=1">1</a></li>
				  <li><a href="#" οnclick="">2</a></li>
				  <li><a href="#">3</a></li>
				  <li><a href="#">4</a></li>
				  <li><a href="#">5</a></li>
				  <li class="disabled"><a href="#" >»</a></li>
				  </ul><br/>
    		</td>
    	</tr>
    	<tr>
    		<td colspan="3">
    			<a href="javascript:void(0);" οnclick="onPage($('#first'))">首页</a>
    			<a href="javascript:void(0);" οnclick="onPage($('#next'))">下一页</a>
    			<a href="javascript:void(0);" οnclick="onPage($('#pre'))">上一页</a>
    			<a href="javascript:void(0);" οnclick="onPage($('#last'))">尾页</a>
    		</td>
    	</tr>
    	<tr style="display: none">
    	<td colspan="3">
    		    <form id="first" action="${pageContext.request.contextPath }/userPage?currentPageNum=1" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="首页"/>
    			</form>
    			
    			<c:choose>
    				<c:when test="${page.currentPageNum+1 gt page.totalPageNum}">
    			<form id="next" action="${pageContext.request.contextPath }/userPage?currentPageNum=${page.totalPageNum}" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="下一页"/>
    			</form>
    				</c:when>
    			<c:otherwise>
    			<form id="next" action="${pageContext.request.contextPath }/userPage?currentPageNum=${page.currentPageNum+1}" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="下一页"/>
    			</form>
    			</c:otherwise>
    			</c:choose>    
    			<form id="pre" action="${pageContext.request.contextPath }/userPage?currentPageNum=${page.currentPageNum-1}" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="上一页"/>
    			</form>
    			<form id="last" action="${pageContext.request.contextPath }/userPage?currentPageNum=${page.totalPageNum}" method="post">
    				<input type="hidden" name="userId" value="${view.userId }"/>
    				<input type="hidden" name="userName" value="${view.userName }"/>
    				<input type="submit" value="尾页"/>
    			</form>
    	</td>
    	</tr>
    </table>
    </div>
    
    <br/><br/><br/> <br/><br/><br/>
 <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/> 
    <br/><br/><br/> <br/><br/><br/>
 <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/> 
    <br/><br/><br/> <br/><br/><br/>
 <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/>  <br/><br/><br/> 
 
 <div name="bottom" id="bottom">BOTTOM</div>
 <a href="#top" title="点击跳到top">BOTTOM</a>
  </body>
  <script type="text/javascript">
  	function onPage(pageId){
  	//alert(pageId);;
  	$(pageId).submit();
  	}
  </script>
</html>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值