This content has been marked as final.
Show 3 replies
-
1. Re: DataTable Rendering
ilya_shaikovsky Jul 16, 2009 4:24 AM (in response to israel.bgf)rendered="#{not empty database.resultList}". It will call your getter.
-
2. Re: DataTable Rendering
israel.bgf Jul 16, 2009 2:46 PM (in response to israel.bgf)"ilya_shaikovsky" wrote:
rendered="#{not empty database.resultList}". It will call your getter.
But that's the problem Ilya, the getResultList is a method that perform a database search (i'm using Seam and its Jboss EL), and if i use the getResultList() i will perform another database hit and that's not good. So that's why i'm asking for an internal mechanism of the datatable to be rendered only if its value is not empty.
Or should i really create a list in the backingbean to this purpose?
Example:-- Method public List<Thing> getResultList(){ return em.createEntityManager("from Stuff").getResultList(); } -- Facelets <rich:dataTable value="#{backingbean.getResultList()}" rendered="#{backingbean.getResultList().size()}"> ... <!-- Bad thing, two database hits to do the same thing --> <!-- Is the only way save the search result in a backing bean list, to get it size after? -->
Thks again! -
3. Re: DataTable Rendering
alexsmirnov Jul 16, 2009 6:13 PM (in response to israel.bgf)You can use Seam outjection to keep search result during request and avoid multiply database calls. Keep in mind, UIData component could call value attribute for each JSF lifecycle phase.