Servlet Tutorial

  • what is Servlet .
  • Servlets are robust and object oriented.Used for creating web application .

  • Introduction

    • A Servlet is a server side platform independent, dynamic and multithread java program, which runs in the context of server for extending the functionality of server.
    • When multiple users make a request to the same Servlet then all requests will be processed by the container by creating multiple threads for the same Servlet.
    • Before Servlet, CGI (Common Gateway Interface) programming was used to create web application.
    • A Servlet is quite simply a java class that adheres to the general model of a Servlet as defined by the Servlet API.
    • A Servlet Container, also known as a Servlet Engine translates requests from whatever protocol is being used into objects that the Servlet understands, and also gives the Servlet an object which it can use to send a response. This container is also responsible for managing the lifecycle of a Servlet.

    Advantages of Servlet

    • There are many advantages of Servlet over CGI. The web container creates threads for handling the multiple requests to the Servlet. Threads have a lot of benefits over the Processes such as they share a common memory area, lightweight, cost of communication between the threads are low..
    • The basic benefits of Servlet are as follows:
       o Better performance: because it creates a thread for each request not process.
       o Portability: because it uses java language.
       o Robust: Servlet are managed by JVM so no need to worry about memory leak, garbage collection etc.
       o Secure: because it uses java language.






    javaglobe adsense

    javaglobe adsense