Servlets : Overview

Servlets :

Servlets are the programs that run on a Web Server and bulid webpages on the fly.  A Servlet is a small program that runs inside a web server. It receives and responds to requests from web clients.

Terminolgies :

Container : It provides the runtime environment for web apps or JEE applications. It performs various tasks like Life Cycle Management, Multi threading support, Object Pooling, Security etc.

Server : It is a running program or software that provides services. There are two types of Servers :

  • Web Server  : It only contains web or servlet container. It can be used for servlets, JSP, struts, jsf etc. It can’t be used for EJB.
    Examples : Apache Tomcat, Resin
  • Application Server : It contains Web and EJB containers.
    Examples : Apache Tomcat, Weblogic, Glassfish.

HTTP : HyperText Transfer Protocol : It is a protocol used by the web browsers and servers to communicate and exchange data over web. It is a request-response protocol and uses reliable TCP connections by default, on port 80. It is stateless means each request is considered new or we can say that, the server doesn’t recognizes the user by default.

Http Request Method :
There are 2 Http Request Methods : GET and POST for sending request to the server.

In case of GET request, only limited amount of
data can be sent
In POST ,unlimited amount of data can be sent
It is not secure because data sent can be seen in
URL bar
It is secure because data sent cannot be seen in URL bar
It can be bookmarked It cannot be bookmarked
It is idempotent which means that the request of
next request will be ignored until response of the previous one is delievered.
It is not idempotent.

Leave a Reply

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