Implementation of the paging function in JSP

Source: Internet
Author: User

In fact, this function mainly involves four functional points.

1. Implementation of the home page Function

<A href = "javascript: gotopage (1)" Title = "Homepage" style = "cursor: hand;">

</A>

2. Implementation of the last page Function

<A href = "javascript: gotopage ($ {pagecount})" Title = "last page" style = "cursor: hand;">

</A>

3. Implementation of page numbers near the current page in the middle

<S: iterator begin = "% {beginpageindex}" End = "% {endpageindex}" Var = "num"> <! -- Num: Do not miss it. It is used to record the number between beginindex and endpageindex -->

<S: If test = "# num = currentpage">
<SPAN class = "pageselectornum pageselectorselected" >$ {num} </span>
</S: If>
<S: else>
<SPAN class = "pageselectornum" style = "cursor: hand;" onclick = "gotopage ($ {num});" >$ {num} </span>
</S: else>
</S: iterator>

4. Transfer to function implementation

<Select onchange = "gotopage (this. Value)">
<S: iterator begin = "1" End = "% {pagecount}" Var = "num">
<Option value = "$ {num}" >$ {num} </option>
</S: iterator>
</SELECT>

 

<! -- The following code implements "go to" display as current page -->

<SCRIPT type = "text/JavaScript">
$ ("# _ PN"). Val ("$ {currentpage }");
</SCRIPT>

5. The implementation of Jump functions is as follows:

<SCRIPT type = "text/JavaScript">
Function gotopage (pagenum ){
Window. Location. href = "topic_show.action? Id =$ {ID} & pagenum = "+ pagenum;
}
</SCRIPT>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.