Java Reference
In-Depth Information
for dynamic web pages—pages whose content changes according to the particular
user or in response to changing data. Some common examples are listed below.
Results of a real-time, online survey.
Results of a search operation.
Contents of an electronic shopping cart.
One powerful way of satisfying this need is to use Java servlets .
Servlet Basics
A servlet is a program written in Java that runs on a Web server. It is executed in
response to a client's (i.e., a browser's) HTTP request and creates a document (usu-
ally an HTML document) to be returned to the client by the server. It extends the
functionality of the server, without the performance limitations associated with CGI
programs. All the major Web servers now have support for servlets.
A servlet is Java code that is executed on the server, while an applet is Java
code that is executed on the client. As such, a servlet may be considered to be the
server-side equivalent of an applet. However, Java's servlet API is not part of Java
SE (Standard Edition), though it is included in Java EE (Enterprise Edition).
This means that non-Enterprise users must download an implementation of the
Java servlet API.
Setting Up the Servlet API
The offi cial Reference Implementation of the Java Servlet API (as mentioned in
Sect. 7.12 ) is Tomcat , a very popular open source server produced by the Apache
Software Foundation. The latest stable version of Tomcat at the time of writing is
7.0.34 and this is the version to which reference is made below, simply for the
convenience of having some version number to use. This version will undoubtedly
be different by the time the current text is published, but the required steps are likely
to remain much the same, with the only notable changes being in the number of the
version and the names of the associated installation folders. Obviously, the user will
normally want to select the latest non-beta version.
1 . Go to .
2 . Click on the Tomcat 7.0 link in the Download column on the left of the screen.
3. Click on the 7.0.34 link.
4. Click on the zip link for your platform and architecture after the 'Core' bullet
under Binary Distributions . If you have selected 64-bit Windows, this will cause
fi le (size 8.53 MB) to be downloaded.
5. Click on Save , navigate to a suitable location (your Java SE folder?) and then
click on Save again.
Search WWH ::

Custom Search