Describe Java Servlets

A servlet can most simply be described as custom web-server extensions, whose job are to process requests and dynamically construct appropriate responses. In practice such responses are usually returned in the form of HTML or XML and are the result of a user making an HTTP request via a web browser. Servlet technology has been an extremely popular choice for building dynamic web applications such as e-commerce sites, online banking, and news portals to name a few, for reasons of simplicity,extensibility, efficiency, and performance over alternative technologies such as CGI scripts.

Some of the most basic advantages of servlet technology are as follows:
❑ Simplicity: Servlets are easy to write, and all the complicated threading and request delegating is managed by the servlet container.
❑ Extensibility: The Servlet API is completely protocol independent.
❑ Efficiency: Unlike CGI scripts the execution of a servlet doesn't require a separate process to be  spawned by the web server each time.
❑ Performance: Servlets are persistent and their life cycle extends beyond that of each HTTP request.

Servlets are simply Java classes that inherit from the javax.servlet.Servlet interface, which are compiled and deployed inside of a servlet container, which is a Java environment that manages the life cycle of the servlet and deals with the lower-level socket-based communication. The servlet container may be part of an existing Java-enabled web server itself or may be used as a stand-alone product that is integrated with athird-party web server. The servle t Reference Implementation container, Jakarta Tomcat for example, may be used as a stand-alone web server or can be used as a separate servlet container inside a larger commercial web server such as the Apache web server.

Servlets are typically used for returning text-based content such as HTML, XML, WML, and so on, but are equally at home returning binary data such as images or serialized Java objects, which are often used by further servlets to generate some appropriate dynamic response.

No comments:

Post a Comment