IBM AS/400E Network Router User Manual


 
Chapter 8. Writing Java Servlets
Servlets are ordinary Java programs that use additional packages (and the
associated classes and methods) found in the Java Servlet API. Servlets generate
dynamic content for web pages and run on the server.
The server can load a servlet automatically when it starts, or when the first client
makes a request for the services of the servlet. Once loaded, servlets stay running,
waiting for additional client requests.
Servlets extend the capabilities of the web server by creating a framework for
providing requests and or response services over the web. A client sends a request
to the server. The server sends the request information to the servlet. The servlet
then constructs a response that the server sends back to the client. Servlets run
independently of protocol or platform.
Java servlets can offer a performance advantage. Because they run on the server,
they dont require download time.This makes servlets faster than applications
which run on the clients system and require download time. When you choose to
use a servlet, you dont encounter difficulties with the application passing through
a firewall. Java servlets also offer an additional performance advantage because
they are multi-threaded.
Because it is a Java program, the servlet can use all the capabilities of the Java
language in constructing the response. The servlet can also interact with outside
resources, such as files, databases or other applications (also written in Java, or
other languages), to construct the response.
The response to the client, therefore, can be a dynamic and unique response to the
particular interaction, rather than an existing static HTML page.
Overview of servlets
Servlets perform a wide range of functions, such as:
v A servlet can create and return an entire HTML web page, with dynamic content
based on the nature of the client request.
v A servlet can create just a portion of an HTML web page embedded in an
existing static HTML web page.
v A servlet can communicate with other resources on the server, including
databases, other Java applications, and applications written in other languages.
v A servlet can handle connections with multiple clients, accepting input from and
broadcasting results to the multiple clients. A servlet could, for example, be a
multi-player game server.
v You can develop a servlet that allows a client to upload an agent to the server
where the server runs the servlet.
IBMs WebSphere
Application Server provides the foundation for deploying and
running your e-business
applications. It provides a secure, reliable execution
environment for Java servlets. You can build and test Java servlets for WebSphere,
© Copyright IBM Corp. 1997, 2000 129