Java Reference
In-Depth Information
HTTP request ; the response from the Web server is known as an HTTP
response . For static Web pages, the HTTP request specifies an address or URL
for an HTML document on the Web server as the target , or requested resource.
The initial page displayed by a browser must be obtained with an absolute,
or full, address. An absolute address , such as
http://www.scsite.com/catalog/books.html
specifies the full path needed to obtain the target Web page. An address also can
be a relative address , such as
java2e.html
which means the location of the requested file, java2e.html, is determined relative
to the location of the requesting page, which must have been obtained from the
same server. For example, if the Web page at the address http://www.scsite.com/
catalog/books.html includes a link that uses
the relative address, java2ehtml, the link tells
the browser to request the page,
http://www.scsite.com/catalog/java2e.html.
If a user requests a static Web page, the
Web server returns it identically for every
request received, without modification in
the HTTP response. When received, the
browser displays the file as a static Web page
(Figure 12-4).
Static Web
page displayed
in browser
Static Web
page displayed
in browser
HTTP request
(with parameter
data, if any)
HTTP response
Server program
FIGURE 12-4
Dynamic Web Pages
For dynamic Web pages, the HTTP request typically contains some data that
is used to tailor the HTTP response. As in the static request, the address specifies
the resource requested from the Web server. If the request is for a dynamic Web
page, the target of the request is not an HTML document but some type of
server-side Web application, such as a servlet, or a JSP. The request is passed to
the Web server, which, in turn, passes the
request to the Web application. The Web
application then processes the request, possi-
bly by accessing a database, passing the
request and additional data to a JSP as a part
of the Web application, or even accessing a
service from another remote Web applica-
tion. The Web application then passes a
response back to the Web server, usually as
a dynamically-generated HTML document.
The Web server returns the HTML document
as an HTTP response to the browser. The
browser displays the returned HTML docu-
ment without concern as to how it was gen-
erated, either from a static HTML document
or dynamically from a Web application
(Figure 12-5).
Static Web
page with form
input fields
Dynamic Web
page
Parameter and/or
session data
Parameter data
Parameter and/or
session data
Server program
Database
FIGURE 12-5
Search WWH ::




Custom Search