I finally understood the JSP page.

Source: Internet
Author: User

When we query the database,If the query results are many,For example1000Entries,So,It would be intolerable if all of them are displayed on a page.!So we need to display it by page.,Display per page10Or20Line,The purpose of paging is as simple as this.

 

There are many paging Methods,It may be more efficient.,I can only refer to the simplest implementation method here.:How many records are queried,Then calculate the total number of pages,Each page is displayed..

Query the number of records:

Select count (*) from learning

 

Calculate the number of pages:

If (counts % pageSizes = 0) {pageCounts = counts/pageSizes ;}

Else {pageCounts = counts/pageSizes + 1 ;}

Int I = (intPage-1) * pageSizes ;(The algorithm in the book is stupid.,Use my own ideas here,No error)

The above is to determine whether the last page is full,

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.