How to implement paging in JSF 1.1?
A:
Create a DAO class which can return subsets of results by firstrow
and rowcount
, create a bean which holds information about the firstrow
and rowcount
and the current subset of data, create a JSF page which displays the data using <h:dataTable>
and has a bunch of <h:commandButton>
s to invoke paging actions (just do the math based on firstrow
and rowcount
).
You can find more information and code examples in this article, it even covers sorting.
BalusC
2010-04-14 11:23:17
Iam a beginner level of jsf .How to implement ondemand loading in paging (RichFaces)
johnbritto
2010-04-15 05:53:44
For first view, load using lazy loading in getter. For next/prev/etc buttons, just reload in action method. Also see the sample bean code. But since you're using RichFaces (you should really have mentioned that in the question), go for the DataScroller component. It does the same, but only less efficiently since it by default stores everything in the memory (the session), which may be hogging slow if you've a lot of data and/or a lot of users.
BalusC
2010-04-15 11:21:45
thanks for ur reply
johnbritto
2010-04-15 14:10:23