Servlets are server-side Java™ programs that use the Sun Microsystems Java Servlet
API and its associated classes and methods, as defined in the Sun
Microsystems Java Servlet 2.3 Specification. These Java programs
extend the functionality of a Web server by generating dynamic content and
responding to Web client requests. When a browser sends a request to the server,
the server can send the request information to a servlet, so that the servlet
can construct the response that is sent back to the browser.
Just as applets run on a Web browser and extend the browser's capabilities,
servlets run on a Java-enabled Web server and extend the server's capabilities.
Because of their flexibility and scalability, servlets are commonly used to
enable businesses to connect databases to the Web.
Although a servlet can be a completely self-contained program, you can
split application development into two portions:
- The business logic (content generation), which governs the relationship
between input, processing, and output
- The presentation logic (content presentation, or graphic design rules),
which determines how information is presented to the user
Using this paradigm, you may choose to have business logic handled by Java beans,
the presentation logic handled by JavaServer Pages (JSP) or HTML files, and
the HTTP protocol handled by a servlet.
Note: JSP files can be used to manage both the presentation and business logic
for a Web application. JSP files use structured markup for presentation, and
supply servlet model behavior at run time.
You can develop, debug, and deploy servlets, set breakpoints within servlet
objects, and step through code to make changes that are dynamically folded
into the running servlet on a running server, without having to restart each
For more information about servlets, refer to the Sun Microsystems Java Servlet
2.3 Specification at java.sun.com/products/servlet/download.html.