CHAPTER 9 STATE NAVIGATION PATTERN number of
CHAPTER 9 STATE NAVIGATION PATTERN number of XML DOM methods (for example, element.[example method]) are called. What happens in the extractFormDatamethod is that the XML elements form and elementare searched for. If a form XML element is found, it is a reference to an HTML form that is retrieved from the current HTML page by using the method document.forms[objData.formId]. The HTML form reference is needed to assign individual HTML form elements. If an element XML element is found, the value is assigned by retrieving the identifier from the XML attribute (element.attributes.getNamedItem(”id”).nodeValue) and the child value (element. childNodes[0].nodeValue). The form element is assigned the value by using the reference objData.formNode.elements[elementIdentifier].value = elementValue.In the example, there is no attempt made to test whether the HTML element is a check box or list box. This was done on purpose to keep the explanation simple, and in the complete implementation of extractFormData those additional attributes would be tested. The method loadState is used to begin the HTML page-loading process and is defined as follows: loadState : function() { if( location.hash != null) { var asynch = new Asynchronous(); var thisReference = this; asynch.openCallback = function( xmlhttp) { if( location.hash.length == 0) { xmlhttp.setRequestHeader( thisReference.constPageStateHeader, “none”); } else { xmlhttp.setRequestHeader( thisReference.constPageStateHeader, location.hash.slice(1)); } xmlhttp.setRequestHeader( “Accept”, thisReference.constResourceStateContentType); thisReference.verifyWindowName(); xmlhttp.setRequestHeader( thisReference.constPageWindowName, window.name); } var xmlhttp = asynch._xmlhttp; asynch.complete = function( status, statusText, responseText, responseXML) { thisReference.verify = thisReference.extractUserData; var objData = new Object(); XMLIterateElements( thisReference, objData, responseXML); if( objData.foundElement) { thisReference.onLoadState( status, objData.foundElement); } location.replace( location.pathname + “#” + xmlhttp.getResponseHeader( thisReference.constPageStateHeader)); }
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.