Paginating tables
When you need to display large tables (with many rows), it can be useful to implement a pagination mechanism. There are many advantages, such as its fancy look, the clear presentation of data, saving space in web pages, and lazy loading.
In a standard version of such a table, we should be able to navigate to the first page, last page, next page, previous page, and in some tables, to select the number of rows displayed on one page.
When you bind a table to its backing bean, you have access to three handy properties, which are listed as follows:
first
: This property represents the first row number that is displayed in the current table page (it starts from the default value0
). The value for this property can be specified using thefirst
attribute of the<h:dataTable>
tag. In the JSF API, this is accessible through theHtmlDataTable.getFirst
andHtmlDataTable.setFirst
methods.rows
: This property represents the number of rows displayed in a single page, starting fromfirst...