Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

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 value 0). The value for this property can be specified using the first attribute of the <h:dataTable> tag. In the JSF API, this is accessible through the HtmlDataTable.getFirst and HtmlDataTable.setFirst methods.

  • rows: This property represents the number of rows displayed in a single page, starting from first...