It is a technology used to create web application.This tech. is robust and scalable and uses java language.There are many interfaces and classes in the servlet API:
Generic
HTTP
Servlet Request
Servlet Response

Advantages of servlet:
There are many advantages of a servlet.tHE WEB container create threads for handling multiple requests.Threads have a lot of benefit over the processes such as they share common memory area,lightweight cost of threads,cost of communication b/w threads is low.

1)Better performance
As they create a thread for each request not processed.

2)Portability
Servlet portability is because it uses JAVA language

3)Robust
Servlets are managed by JVM.So no need to worry about memory leak.

4)Garbage Collection

5)Security
Java provides the security

HTTP Request methods
Every request has a header that tells the status of the client.There are many methods of the request.
GET n POST are the commonly used methods

GET()
this method is used to get the resources at the requested URL

POST()
This method asks the server to accept the body info attached.

HEAD()
this method is used only for the header part.

TRACE()
this method asks for the loop back of the request message.

PUT()
it says to put the resource info at the requested URL

DELETE()
it says to delete the resource at the requested URL.

Differecnce b/w GET n POST
1)DATA
in case of GET limited amount of data can be sent because data is sent in header.
in case of POST large amount of data can be sent because data is sent in body.

2)SECURITY
in case of GET data is not secure since it is exposeed in URL
in case of POST data is secured since it is not exposed in URL

3)
GET request can be bookmarked
POST request can not be bookmarked

4)EFFICIENCY
GET request is more efficient and is used more than post.
POST request is less efficient.

Life Cycle of a SERVLET.
The servlet completes its cycle in 5 steps

1)Loading Servlet Class
2)Servlet instance creation
3)Init() is invoked
4)Service() is invoked
5)Destroy() is invoked

1)The class loaded is responsible or loading the servlet class.The servlet class is loaded when the first request is received by web container.

2)The web container creates the instance of servlet after loading the servlet class.The servlet instance is created only once in the life cycle.

3)The web container calls the Init() only once after creating the instance.The init() is used to initialise the servlet.It is a lifecycle of a method of servlet interface.

4)The web container calls the Service() each time when the request of the web is received.If the  servlet is initialised it calls the service method.Service() takes 2 arguments:

5)The web container calls the destroy() before removing the servlet instance from service.It gives the servlet an opportunity to clean any resources from memory.