CHAPTER 9 STATE NAVIGATION PATTERN Nothing To (Web server setup)

CHAPTER 9 STATE NAVIGATION PATTERN

Nothing



To explain the HTML page, the code will be cross-referenced to the events that are used to load or save the state. When an HTML page has finished loading, an event is triggered to indicate that the document is complete and can be manipulated. The event onload is attached to the HTML body tag and assigned to calling the method StateController.loadState(). The variable StateController is a global instance that implements the client-side State Navigation layer. This variable is a global instance because an HTML page cannot contain two states, and hence making the variable a type would be pointless. The StateController.loadState() method is called when the HTML document has finished loading and is used to retrieve the state of the HTML page from the server side. In the implementation of the loadState method, the XMLHttpRequest object is called and asks the server for the state of the page. The server eventually responds, and StateController will automatically call the StateController.onLoadState method defined in the HTML page. The onLoadState method is called after the server has responded with the associated state of the page. The client is responsible for picking apart what the state is and updating the HTML page with the information. In the example HTML page, the method loadForm is called and delegates the state restoration to a StateController-implemented standard function that deserializes the incoming state. Saving the state is a bit more complicated because it requires that the HTML page interject the HTML form-posting process. To interject, the onsubmit event is implemented and calls the method StateController.saveState(). Calling the saveStatemethod will trigger a State Navigation defined process that calls the StateController.onSaveState method defined in the HTML page. Within the onSaveState method, the HTML page will generate a user-defined state that is saved. In the case of the HTML page, the method saveForm is called, which will serialize a particular HTML form. In most cases, the Representation Morphing pattern is implemented. From the perspective of the HTML page, saving and loading the page state requires making the right calls at the right moment. What is important is that the user has the ability to define when and how the state associated with the HTML page is managed. This means that a page state could be saved as the result of a specific hyperlink that is clicked, and that the page state is reloaded as the result of some button that is clicked. Or the developer could choose to ignore saving the state by adding a Cancel or Ignore button. It is the choice of the developer. As a matter of simplicity and illustration of the Representation Morphing pattern, I chose to define the state of the HTML page as an HTML form, but I could just as easily have defined
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Leave a Reply