What are Servlets?

What are Servlets?

All Java programmers probably know what Java applets are and how they differ from Java applications. After all applets were Java’s gateway into the Internet. Servlets are Java’s entry into the server side of the client-server paradigm.

Servlets are Java’s server-side counterpart of applets and are also known as “faceless applets.” Just as applets run in Web browsers, servlets run in Web servers. Unlike applets, servlets have no standard user interface. In JDK 1.2, Java has an extension package, javax.servlet that defines the Servlet API. The most common use for servlets is as a replacement for CGI scripts.

A servlet’s main purpose in life is to server up HTML to the client, most often through the HTTP protocol. Servlets are created, managed, and destroyed by the Web server that they run in. They are known only in the context of a Web server. Some of the popular Web servers that support servlets are Microsoft IIS, Netscape Enterprise, Apache server, and the Sun Web server.

Servlets help support thin clients. Computation-intensive functionality can be moved over to the server side and accessed via servlets instead of forcing the client to download the necessary classes to the client side.


Share the Post: