The
JSF DataModel classes are actually quite easy to use and they make JSF coding a lot simpler than the way so many people attempt to work with tables using View-side parameters and other cruft.
All that is required is this:
1. Change your "getList" method to return a DataModel object.
2. Create the Datamodel:
This version wraps the list as part of the model construction, but you can also build the model and wrap it around the list in a more primitive way:
You have the option of caching the list itself as an internal bean property or retrieving it from the model via getWrappedData, whichever suits you. Once wrapped, you don't have to re-wrap the list if it changes, only if you replace it with an entirely new List.
Note that when using model objects (DataModel or SelectItem), the bean that contains those objects cannot be Request-scoped, since the original model would be destroyed after its first use and a new instance would lack the context that had been created.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.