The poll results and the real-time trading data are dynamic elements that are unknown until run time, but elements that should be added or updated when the server side sends a signal. A previous developer Works article, "Craft Ajax applications using JSF with CSS and Java Script, Part 2: Dynamic JSF forms" explains how to hide and display optional JSF components without refreshing a Web page.
However, you can't use the method described in that article to solve this problem.
These history items can also hold data that you can later extract to restore the page state.
Pages can add state objects between their entry in the session history and the next (“forward”) entry.
At this time, JSF has no good solution to this problem.
Although you may be familiar with Java Swing applications such as "clock," in which data changes prompt GUI updates, or you might have read the implementation details of such applications in some basic Swing development guides, this approach will not work with my scenarios.
Swing already provides a mature way to automatically update the GUI based solely on the internal data status, but JSF does not have good support for refreshing the GUI based on a request from the server side.
If you check the standard life cycle of JSF, you will find that the user normally needs to produce an event on the Web page (by clicking a button, for example) to invoke the GUI refresh.
View image at full size After building a framework that monitors data changes on the server side, you need to find a way to update the data model and create dynamic GUI elements if the bean is to be notified of any changes.
This process takes place inside the managed bean (see the Bean layer of Figure 2) and can be divided into two sub-processes: updating the data model and creating GUI elements.
Fragment identifiers, like those used on this article’s headings via the attribute, provide some state information, but they’re entirely dependent on client-side scripts.
The changes to the History API are intended to give developers ways to push history items to the browser so the native back and forward actions can cycle through those items.
With the rise of more dynamic web pages, we need more control.