Advanced Java and Web Technologies for JNTUK
Blog providing beginner tutorials on different web technologies like HTML, CSS, Javascript, PHP, MYSQL, XML, Java Beans, Servlets, JSP and AJAX

02/10/2016 Categories: Servlets. No Comments on Introduction to Servlets

Servlets is a Java based technology for server side processing. Other languages or technologies for server side processing are PHP, JSP, node.js, Perl etc.



Definition of a Servlet


A servlet is a special Java class which is dynamically loaded on the server and used to generate dynamic content.


Following are the general steps that happen when a client requests a servlet:

  1. Client sends a HTTP request from web browser containing a URL with servlet.
  2. Web server receives the request and forwards the request to application server.
  3. Using information available in xml (deployment descriptor) the servlet container loads the object appropriate servlet class.
  4. If required, the servlet retrieves data from database, processes it and sends the response back to web server.
  5. Web server forwards the response back to the client who sent the request.


Above steps can be illustrated as follows:




Features of Servlets


Following are the features of servlets:

  • High-level
  • Component-based
  • Platform independent
  • Server independent
  • High performance (overcomes CGI limitation)
  • Highly scalable


CGI vs. Servlets


Following are the differences between Common Gateway Interface (CGI) and Servlets:




Servlet Container


Servlet container or servlet engine is a set of objects that provides the runtime environment for servlets. Servlet container manages the life cycle of a servlet.


Following functionality is provided by the servlet container:

  • Network services
  • Decoding and encoding of MIME based messages
  • Servlet life cycle management
  • Resource management
  • Security
  • Session management

Related Links:

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up