[ Team LiB ] Previous Section Next Section


The Workshop is designed to help you review what you have learned and help you to further increase your understanding of the material covered in this hour.



Which TCP/IP port does an HTTP server listen on?


When using a servlet to produce an HTML response, which header field must be set prior to writing to the output stream?


Give one reason to use an HTTP GET request method rather than a POST request method to submit information.



HTTP servers typically use the well-known port 80. Tomcat's internal Web server listens on port 8080 by default. Web Servers that support HTTPS use port 443.


When using a servlet, you must set the content-type header field like this:


It isn't necessary to do this for a JSP—it defaults to this.


A common reason for using the GET request method is because URLs are almost always completely parsed. Using POST, programs have to do some additional work to get to the posted data. However, the performance loss is negligible. A better reason to use GET is so that the URL can be bookmarked.


  1. Write a JSP that examines the HTTP header to detect which browser made a request. Output text to indicate your finding.

  2. Using the software you created for the exercises in Hour 3, "Creating HTML Forms," change the form targets to DumpHeaders.jsp and look at the headers.

    [ Team LiB ] Previous Section Next Section