Reputation: 1476
I managed to create bundle with Primefaces. I want to create Java buffer and store there messages in FIFO order. When message is inserted into the buffer I want to display it into the JSF page. How I can do this with Primefaces?
I found example with Primefaces:
<h:form id="dccd">
<p:growl id="growl" showDetail="true" sticky="true" />
<p:panel header="Growl">
<h:panelGrid columns="2">
<h:outputText value="Your Name: *" />
<p:inputText value="#{bean.text}" required="true" label="Name"/>
</h:panelGrid>
<p:commandButton value="Save" actionListener="#{bean.save}" update="growl"/>
</p:panel>
</h:form>
But this is working only when I call action listener.
Upvotes: 1
Views: 728
Reputation: 20359
The reason your example only works when pushing the button is that you're updating the growl element.
You can do two things to make sure you keep getting new messages.
When using push the server pushes updates to the client when necessary. PrimeFaces has some examples that may help you realize push. I don't know if this works on all browsers though.
Using polling the client periodically checks for updates (can generate a lot of network traffic). PrimeFaces has a poll element to make things easier, have a look at the example. AFAIK it uses JavaScript so it should work on most modern browsers.
Upvotes: 3