43
Chapter 2
Building Web Applications Using
Servlets and JSP
Protocol is everything.
—François Giuliani
The core Internet protocols substantiate and sustain the Web, so understanding these protocols is
fundamental to understanding how web applications are developed.
The Internet is a colossal network of networks, and in general, all of the machines on the Internet
can be classified into two types: the server and the client. The client is the machine requesting some
information, and the server is the machine that provides that information. The information data that
flows from the information provider (that is, the server) to the information requester (that is, the client)
is bound by a definite rule that governs the marshaling of the information to be transmitted by the
server and the unmarshaling of the information to be translated or read by the client. This rule is
called the protocol. The web browser (that is, the client), the web server (that is, the server), and the
web application all converse with each other through the Hypertext Transfer Protocol (HTTP). The
clients send HTTP requests to the web servers, and the web servers return the requested data in the
form of HTTP responses. The HTTP clients and the HTTP servers are the bricks and mortar that lay
the foundation of the World Wide Web, and HTTP is the lingua franca of the Web.
HTTP is a request-response stateless protocol, the corollary of which is that, from the web server’s
view, any request is the first request from the web browser. When a client makes a request for the
resource, the request also encloses the identification of the resource being requested, in the form of
a Uniform Resource Locator (URL). URLs are described in RFC 3986^1 as a uniform way of uniquely
identifying a resource. URLs are designed to implicitly provide a means of locating a resource by
describing its “location” on a network.