CHAPTER 10 (Affordable web hosting) INFINITE DATA PATTERN between SendData1
CHAPTER 10 INFINITE DATA PATTERN between SendData1 and SendData2 is that one function uses the identifier 1, and the other uses the identifier 2. For those readers who are cringing because of using the hard-coded numeric identifiers 1 and 2, well, you are right. There is a better way of writing the code, but it will not be illustrated here because that would make the explanation of the pattern more difficult. Here is the implementation of SendData1: function SendData1() { transactionIdentifier1Counter ++; document.getElementById( “result1″).innerHTML = “No Result”; var buffer = GenerateActionData( “1_” + transactionIdentifier1Counter, document.getElementById( ‘Number1′).value); client.send( “application/xml”, buffer.length, buffer); } Calling SendData1 means creating a new task on the server, thus invalidating the results of the old tasks that may be executing. The implementation of SendData1 begins with the incrementing of the first task transaction identifier (transactionIdentifier1Counter). Using a static random transaction identifier would result in the scenario where multiple requests would be sending results with the same transaction identifier, thus corrupting the results. As a new task is being created, the content of the result span element (result1) is cleared. The XML buffer that is sent is created by using the function GenerateActionData. The function GenerateActionData has two parameters; the first parameter is the transaction identifier, and the second parameter is the maximum number to calculate all primes for. The generated XML buffer is sent to the server by using the method client.send. Following is the implementation of GenerateActionData that generates the XML buffer: function GenerateActionData( transactionIdentifier, number) { return “
We recommend high quality webhost to host and run your jsp application: christian web host services.