![]() |
Pagination is a sequence of pages that are connected and have similar content. Pagination is a technique for splitting a list of multiple records into subsists. For example, you search with a keyword on Google and receive tens of thousands of results. It is important to note that even when the content on a section of a page is split into distinct pages, we will still define that as pagination. Pagination in JavaTo divide a large number of records into multiple parts, we use pagination. It allows users to display a part of records only. Loading all records on a single page may take time, so it is always recommended to created pagination. In java, we can develop pagination examples easily. In this pagination example, we are using the MySQL database to fetch records. ExampleStep 1: Create a table in Mysql create table employee(empid int(11),empname varchar(20),empsalary int(11),empdept varchar(20)); Step 2: Create a JavaBean class for setting values to the database and getting values from the database. Java
Step 3: Creating a factory class for Getting connections from the DataBase. Java
Step 4: Creating a Dao class for creating a Factory class Object and calling in that method. And create a query and set it to JavaBean object and added to ArrayList Object. Java
Step 5: Create a Servlet class and create a DAO class Object and call the method and Forwarded to display.jsp page Java
Step 6: Configure web.xml file XML
Step 7: Create a display.jsp file for Displaying records for 5 to 5 records HTML
Output:
Fetching millions of records from a database consumes almost all the CPU power and memory of the machine. Hence we break millions of records into small chunks showing a limited number of records (say 5 or 10) per page. |
Reffered: https://www.geeksforgeeks.org
Java |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 10 |