In the previous article, we have completed the background processing of the pagination display and now proceed to the front-end processing.
Expected display results:
Because of different items, different database data parts, so we will be paged out part of the page to create a separate JSP pages:
1<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "2pageencoding= "UTF-8"%>3<%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%>4<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >567<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">8<title>insert title here</title>9Ten<body> One<div id= "Page_nav" align= "Center" > A<a href= "${page.path}?pageno=1" > Home </a> -<a href= "${page.path}?pageno=${page.pagenumber-1}" > Prev </a> -<c:choose> the<c:when test= "${page.totalpage<=5}" > -<c:set var= "Begin" value= "1" ></c:set> -<c:set var= "End" value= "${page.totalpage}" ></c:set> -</c:when> +<c:when test= "${page.pagenumber<=3}" > -<c:set var= "Begin" value= "1" ></c:set> +<c:set var= "End" value= "5" ></c:set> A</c:when> at -<c:otherwise> -<c:set var= "Begin" Value= "${page.pagenumber-2}" ></c:set> -<c:set var= "End" value= "${page.pagenumber+2}" ></c:set> - -<c:ifTest= "${end>page.totalpage}" > in<c:set var= "Begin" Value= "${page.pagenumber-4}" ></c:set> -<c:set var= "End" value= "${page.totalpage}" ></c:set> to</C:if> +</c:otherwise> -</c:choose> the *<c:foreach begin= "${begin}" end= "${end}" var= "num" > $<c:iftest= "${page.pagenumber== num}" >Panax Notoginseng<a href= "${page.path}?pageno=${num}" > "${num}" </a> -</C:if> the<c:iftest= "${page.pagenumber!= num}" > +<a href= "${page.path}?pageno=${num}" >${num}</a> A</C:if> the</c:forEach> +<a href= "${page.path}?pageno=${page.pagenumber +1}" > Next </a> -<a href= "${page.path}?pageno=${page.totalpage}" > End </a> $Total ${page.totalpage} page, ${page.totalrecord} entry to <input value= "${page.totalpage}" name = "pn" id = "Pn_input"/>page $<input type= "button" value= "OK" id= "btn_id"/> -<script type= "Text/javascript" > -$ ("#btn_id"). Click (function () { thevar value= $ ("#pn_input"). Val (); -Window.location= "${page.path}?pageno=" +value;Wuyi }) the</script> -</div> Wu</body> -
The above code to achieve the function of the jump page, automatically display 5 pages, and the current page >=3 and <= the total number of pages in the center display, such as "4":
Finally, the paging page is included in the JSP of the Data query Display page.
1 <!--paging Information--2 <% @include file= "/web-inf/view/paging.jsp"%>
Pagination Displays data----front end (pagination of information in a database to a Web page)