When an HTTP server sends the contents of a document to a client in a response body, it uses the Content-Length header line to specify the byte length of the body. For static documents, the byte length is provided by the file system. But for dynamically generated Web pages, such as those generated by a CGI script, the length must be determined at run time, on the fly.

a)For a dynamically generated Web page, how can the server come up with the content length specified in the Content-Length header? Remember that header lines appear before the body in a HTTP RESPONSE.

b)Look up how HTTP/1.1 address this problem and summarize what you found.

Open a directory on your PC to obtain the files in the servletssimple folder. Compile HelloWorld.java and Counter2.java. Then file them into the designated servlets class directory. (On the Apache Tomcat Server, the default servlet class directory is TOMCAT_HOMEwebappsexamplesWEB-INFclasses.)

a)User the browser to run the HelloWorld servlet.

b)To see that servlets can be run on a server host other than your localhost, use the browser on your system to run the HelloWorld servlet on your instructors system or your neighbors system.

c)Compile the Counter1.java file, and install the resulting class file Counter1.class to the < servlet class file directory>. Then browse to it using the . Refresh the browser repeatedly to run the Counter1 servlet several times. Describe and explain the counter value displayed by the browser successively.

d)Open another browser and browse to the Counter1 servlet. Describe and explain the counter value displayed by the browser.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.