Posted by: ahmedashfaque | June 12, 2017

What is a servlet in Java?

In object oriented programming languages, there is a need to create many classes resulting from the breaking of the entire software product. These classes keep all the programming code. Interaction among all these classes is done through method calls.

In Internet programming (software products hosted as websites), writing source code for the software product is a bit difficult. It is because, there are so many components (servers) get involved: you have a database server, an application server, a web server etc. Due to this type of architecture, all outcomes of computations which need to be displayed to the user should be in HTML format so that it can shown on the user web browser.

Due to these practical considerations, the source code needs to be written in scripting languages or a combination of compiled code and scripting languages. Since scripting languages are interpreted and thus run slow (performance issues will arise), writing source code in compiled classes is far better.

But when you have your source code inside a compiled class then accessing it from HTML or scripting web pages is impossible. There is only one way to do it. Define the path of the compiled code file in an XML file and then call this piece of compiled code in your scripts.

In Java programming, servlets are the compiled classes which can be called from scripts. All other compiled classes need to be accessed from scripts only through the servlet classes.



  1. Well studied blog is presented here; it carries explained information that helps the readers with every detail about the subject.

  2. Thankyou for wonderful article. It has more Information in Your Website sap training videos.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: