The two main servlet types are, generic and HTTP.
Generic servlets:
Extend javax.servlet.GenericServlet.
Contain no inherent HTTP support or any other transport protocol, so that protocol is independent.
HTTP servlets:
Extend javax.servlet.HttpServlet.
Contain built-in HTTP protocol support and are more useful in a Sun Java System Web Server 7.0 environment.
For both servlet types, you must implement the initializer method init() to allocate and initialize the servlet, and the destructor method destroy() to deallocate resources.
All servlets must implement a service() method, which is responsible for handling servlet requests. For generic servlets, override the service method to provide routines for handling requests. HTTP servlets provide a service method that automatically routes the request to another method in the servlet based on which HTTP transfer method is used. For HTTP servlets, override doPost() to process POST requests, doGet() to process GET requests, and so on.