Hi,
I have been using <a4j:poll>
to render a segment of a .xhtml page but the underlying bean getter method is being called multiple times, potentially causing a performance issue but also unexpected behaviour.
The code is as following
.xhtml: <a4j:region> <h:form> <a4j:poll id="poll" interval="2000" enabled="true" reRender="numberGrid" /> </h:form> </a4j:region> <h:panelGrid> <h:outputText id="numberGrid" value="#{number}" /> </h:panelGrid> Bean: @Name("number") public class RandomNumber() { private int number; @Unwrap public getNumber(){ Random random = new Random(); number = random.nextInt(12); return number; } }
Can anyone help explain and throw some light on an alternative solution?
Regards