You are on page 1of 1

Java Servlets

Servlets are used primarily with web servers, where they provide a
Java-based replacement for CGI scripts. They can be used to provide
dynamic web content like CGI scripts.
Advantages of servlets over CGI scripts:
1.
Servlets are persistent between invocations, which dramatically
improves performance relative to CGI programs.
2.
Servlets are portable among operating systems and among
servers.
3.
Servlets have access to all the APIs of the Java platform (e.g. a
servlet can interact with a database using JDBC API).
Servlets are a natural fit if you are using the web for enterprise
computing. Web browsers then function as universally available thin
clients; the web server becomes middleware responsible for running
applications for these clients.
Thus the user makes a request of the web server, the server invokes a servlet
designed to handle the request, and the result is returned to the user in the web
browser. The servlet can use JNDI, Java IDL, JDBC, and other enterprise APIs to
perform whatever task is necessary to fulfill the request.

Servlets can be used when collaboration is needed between people. A


servlet can handle multiple requests concurrently, and can synchronize
requests. So servlets can support on-line conferencing.
Servlets can forward requests to other servers and servlets. Thus,
servlets can be used to balance load among several servers that mirror
the same content, and to partition a single logical service over several
servers, according to task type or organizational boundaries.

You might also like