java – Dynamically update a primefaces table

Question:

Hi, I'm creating a java registration with Primefaces. I have the following problem: I have a screen in xhtml and it loads the registered data, so far so good. The problem is when someone on another computer is logging in at the same time, they won't be able to see the new record that was entered, they'll only be able to see if they hit F5 on the page to update. Does anyone know how to make this implementation so that this problem is resolved?

Answer:

Hi,

you can add an event that updates the table every so often.

<p:poll interval="10" listener="#{tabelaBean.carregarTabela}"
            update="idDaTabela"/>

with this function, your table will be updated every 10 seconds.

Scroll to Top