Saturday, May 19, 2018

Overview of Servlets in Java | Servlet Tutorials

Leave a Comment

Overview of Servlets in Java

Servlets provide a Java based solution used to address the problems currently associated with doing server side programming including in extensible scripting solution, platform specific API’s, and incomplete interfaces.

Servlets are objects that confirm to a specific interface that can be plugged into a Java based server. Servlets are to the server side what applets are to the client side object byte code that can be dynamically loaded off the net.

They differ from applets. In that they are face less objects (with out graphics or GUI component).They serve as platform independent, dynamically loadable, pluggable helper byte code objects on the server side that can be used to dynamically extend server side functionality.

For example, an HTTP servlet can be used to generate dynamic HTML content. When you use servlets to do dynamic content you get the following advantages:

They are faster and cleaner than CGI scripts
They use a standard API (the servlet API)
They provide all the advantages of Java(run on variety of servers with out needing to be rewritten)

The Attractiveness of Servlets

There are many features of servlets that make them easy and attractive to use. These include:
Easily configured using the GUI based admin Tool.
Can be loaded and invoked from a local disc or remotely across the network.
Can be linked together, or chained so that on a servlet can call another servlet, or several servlets in sequence.
Can be called dynamically from within HTML pages, using server side include tags.
Are secure- even when downloading across the net work, the servlet security model and servlet sandbox protect your system from unfriendly behavior.

The Advantages of the servlet API

One of the great advantages of the servlet API is protocol independence. It assumes nothing about:
The protocol being used to transmit on the net
How it is loaded
The server environment it will be running in tjese qualities are important, because it allows the servlet API to be embedded in many different kindsof servers.
There are other advantages to the servlet API as well.
These include:
It’s extensible-you can inherit all your functionality from the classes made available to you;
It’s simple, small, and easy to use.


The JavaServer provides several important servlet features.
These includes:
Loading and Invoking Servlets

Servlets can be loaded both locally and remotely.

Filters and Servlet Chaining

The JavaServer uses mime types to call servlets sequentially.

Server-Side Includes

Server can be invoked from dynamic HTML docements using server-side include tags.

Replacing CGI Scripts

Servlets are an effective substitute for CGI scripts, and provide a faster and cleaner way to genarate dynamic documents.


The Java TM Web Server TM servlet architecture is very flexible and the server takes advantage of thie by dividing its work among several internal servlets. These are:

File Servlet

The File Servlet provides the standard document serving capabilities of Java Web Server. This servlet includes a caching mechanism to speed up response times for frequently accessed files.

Invoker Servlet

The purpose of this servlet is to invoke other servlets which are explicitly requested by name, that is

http://<server-host-name>/servlets/servlet name.

Server Side Include Servlet

Servlets can be embedded within html documents using the servlet tag. When the server detects the servlet, and sends output of the servlet to the client at the point where the servlet tag was embedded.

Admin Servlet

The Admin servlet facilitates administration of the Java web server through a GUI front end Administration Tool.

CGI Servlet

This servlet acts as a gateway for CGI 1.1 interface. This servlet allows any program that utilizes the CGI 1.1 standard to under operate Java Web Server.

Image Map Servlet

This servlet implements server-side image maps utilizing an extension of standard NCSA map files.
If You Enjoyed This, Take 5 Seconds To Share It


Post a Comment