This sub-process is invoked by the method is used to reorganize the inventory to ensure that books have been assigned to the right categories.
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.
Because actions such as adding or removing a book in the inventory leads the server-side data to change, you must monitor these actions.
The method for monitoring changes is to add a listener looking for changes of server-side data, and have the server-side notify the listener after any change occurs.
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.If you need to see the latest Model, you need to trigger the digest cycle But there is a chance of a digest cycle in progress, so we need to check and init the cycle. Angular JS pass string, numbers and booleans by value while it passes arrays and objects by reference.So you can create an empty object and make your date a property of that object. In controller You have to trigger the change event of the input element because ng-model listens to input events and the scope will be updated.The inventory information such as book categories and the number of books in each category is displayed in the Web home page (see Figure 1).View image at full size To reflect accurate information, you need to synchronize the inventory information of the page with the server-side data in real time.Within this article, I'll describe the following solutions: To better explain my solution, I'll work with a single example throughout the entire article.