Internet Information Server. Some third-party products implement ASP, but you must purchase
them separately at additional costs.
Reasons to Use Java Servlets
Java servlets are one of the most exciting new technologies I have had the opportunity to work
with. Servlets are efficient, persistent, portable, robust, extensible, secure, and they are receiv-
ing widespread acceptance. If you use them only to replace CGI, you will have saved yourself
a lot of time and headache. Servlets solve many common problems you run into when using
CGI, and they prove to have a clear advantage over many of the other alternatives. The follow-
ing sections discuss some of the advantages offered by servlets.
A servlet's initialization code is executed only the first time the Web server loads it. Once the
servlet is loaded, it is only a matter of calling a service method to handle new requests. This is
a much more efficient technique than loading a completely new executable with every request.
Servlets can maintain state between requests. Once a servlet is loaded, it stays resident in
memory while serving incoming requests. A simple example of this is a Vector that holds a list
of categories used in an online catalog. When the servlet is initialized, it queries the database
for a list of categories and stores these categories in a Vector. As it services requests, the
servlet accesses the Vector that holds the categories instead of querying the database again.
Taking advantage of the persistent characteristics of servlets can improve your application's
Servlets are developed using Java; therefore, they are portable. This portability enables servlets
to be moved to a new operating system without changing the source. You can take code that
was compiled on a Windows NT platform and move it to a Solaris box without making any
Because servlets are developed with access to the entire JDK, they are very powerful and
robust solutions. Java provides a well-defined exception hierarchy for error handling. It has a
garbage collector to prevent problems with memory leaks. In addition, it includes a very large
class library that includes network support, file support, database access, distributed object
components, security, and many other classes.