1

I have short question on Primefaces and especially on server-side push capabilities. Due to the given examples on http://www.primefaces.org/showcase/push/index.jsf, I know that it is possible to push a string to the client and force to update some UI-elements.

However, in my case I would need something slightly different: Is it possible to add and push entire components (Buttons, Textfields etc.) to the client?
The push itself will be triggered by an background thread too. So, basically my workflow looks like that:

User -> starts background (multi) threads Background thread -> generates new component (Button, TextField) -> added to UI / bean -> bean / view updated

There can also be longer time ranges when the UI will be updated with a new element again, therefore a simple ajax request, for example, every 5-10 sec. would cause too much traffic.

This question is also related to this: PrimeFaces push component and How to update the GUI from another thread?

Community
  • 1
  • 1
runFatTony
  • 23
  • 4
  • Here is the way I'm currently dealing with a similar need: [Sharing components between views - how to improve my design?](http://stackoverflow.com/questions/25121232/sharing-components-between-views-how-to-improve-my-design) – Zim Aug 06 '14 at 10:04

1 Answers1

0

I have used two approaches that worked:

  1. Use to create a javascript method that you can call from . This remote command can call a listener on the managed bean and do an ajax partial update of your page which can add a component.
  2. Use AngularJS, jquery, or raw javascript to add components to your DOM- this has the benefit of being very fast - not requiring any round-trip to the server.

I hope this helps.

Yoshiya
  • 452
  • 5
  • 17