I am using JSF with Primefaces and using poll to update a table periodically. The following code shows a simplified version of my current code:
<h:form id="form">
<p:datatable id="customerTable" var="customer" value="#{dashboard.customers}">
[...]
</p:datatable>
<p:poll interval="5" update="form:customerTable" />
</h:form>
The update is done every 5 seconds as expected. But the problem is that the customerTable
seems to be loaded several times per update.
My code in the backing bean which is called by the #{dashboard.customers}
is as follows:
public List<Customer> getCustomers()
{
LOG.debug("TEST");
return customerService.loadCustomerList();
}
When I reload the page getCustomers()
is called once, but via the polling it is called several times. Why is it called so often? Is the polling defined incorrectly?