Using polling events to update pages
ADF Faces provides the poll component that have both server and client side events, namely, pollEvent
, which can be used to communicate with the server at specified intervals. This can be useful to provide updates to certain components at a fixed interval, and by decreasing this interval, you are getting close to providing live updates.
In this recipe, we will refresh the employees table every 5 seconds to see the changes in the table, and we will mimic this change by editing values in the database directly and see how it gets reflected on the page. You can refer to the last recipe, or you can grab this project's recipe by cloning ADFFacesPolling
application from the Git repository.
How to do it…
To learn how to use the poll component, follow the ensuing steps:
Open the
adfc-config.xml
file.Drag a view from the Components palette and drop it inside the Diagram mode.
Name the view
pollEmployees
.Double-click on the newly created view to create the page and choose...