Reputation: 1588
I want to pass data from database to JSF page as a table. I know that I can use ArrayList
but I need more efficient way because I have database tables with 2000+ rows and more. I;m not sure but the ArrayList
will consume too much memory. Is there more memory efficient way to send the data to the JSF page?
P.S maybe using pagination?
Upvotes: 0
Views: 1231
Reputation: 37061
You can start with a simple PrimeFaces - DataTable - Pagination Example... its really simple and efficient...
DataTable has built-in support for ajax pagination.
Then if you will deal with really huge data you can take a look at a more advanced example.
Take a look at the PrimeFaces DataTable - Lazy Loading example
DataTable has built-in support to deal with huge datasets. In order to enable lazy loading, a LazyDataModel needs to be implemented to query the datasource when pagination, sorting, filtering or live scrolling happens
And here is a link to all PrimeFaces Datatable ability's
Upvotes: 3
Reputation: 4446
With Richfaces you can use database backed pagination. There is a bunch of example/tutorials if you search for richfaces pagination. Here is one that looks promising:
http://www.myjeeva.com/2011/04/do-jsfrichfacesseam-lazydynamic-data-loading-pagination/
Upvotes: 2