• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Question in Facelets

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am using Facelets and JSF in my application.

In one of the page, am using t:dataTable to iterate over the collection. I see that my getter method was invoked 2 times since am referring it 2 times in my facelets page.

I would like to know how do I cache the collection in my facelets page so that my getter method will get invoked only one time.

I did like this in my facelets page but still my getter method invokes 2 times...

<ui:param name="var" value="#{myBean.myMethodName}"/>

and am referring the value "var" in the datatable.

Please advice what I am doing wrong or please provide how to cache the value in the Facelets so that my backing or managed bean method will be called only one time.

The reason why my method is getting referenced 2 times because am rendering the datatable only when the collection is not empty....

<t:dataTable
id="my-data-table"
forceId="true"
var="data"
value="#{myBean.myCollectionVariable}"
rendered="#{!empty myBean.myCollectionVariable}">

Thanks,
Kumar Saravanan
[ April 03, 2007: Message edited by: Kumar Saravanan ]
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually I use dataTables through bindings instead of using value and rendered attributes.

Using binding you can populate your list, check if is empty and decide if it will show or not loading the list only once.
 
Kumar Saravanan
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Fabio Lin,

Thanks for your reply...

I got your logic like binding the datatable to the backing bean. But If I do that it seems like tight couping between the UI code and the Backing bean code.

Is there any other way to avoid the getter method execution in a repeatable time?

Thanks,
Kumar Saravanan
 
What's that smell? I think this tiny ad may have stepped in something.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic