Adult web hosting - 282 CHAPTER 9 STATE NAVIGATION PATTERN 1.

282 CHAPTER 9 STATE NAVIGATION PATTERN 1. Clicking, checking, or some other HTML action triggers another HTML action that causes an HTML event. 2. The HTML event, which could be an HTML POST or button onclick, builds a state that is used by the client State Navigation layer to create a request. 3. The request is sent to the server, which may or may not be processed by the server-side State Filter layer, and is passed on to the handler. 4. If the State Filter layer filters the request, it does so transparently without modifying the contents. 5. The handler generates content that contains a link used by the State Navigation pattern to load the next resource. In this client-side sequence of events, the State Navigation pattern has three responsibilities: populating the representation with state, generating a state from a representation, and redirecting the page when necessary. The client-side ramification of using the State Navigation pattern is that a representation must possess a state, and that the state can be submitted and retrieved only by using the State Navigation pattern. The state and reference information that is passed between the client side and server side uses XML, but could include other formats such as JSON. For the scope of this pattern, XML is the default data format. The choice of whether to use another format is left up to you. Using the State Navigation from an HTML Page On the client side, the implemented HTML page needs to carry only two major tasks: loading and saving the state, and initiating the state loading and saving process. From an architectural perspective, the HTML page initiates a call to the State Navigation layer, which will call back into the page to carry out the application-specific persistence method calls. Following is an example implementation of the State Navigation pattern that contains an HTML form as illustrated in Figures 9-4 to 9-7: