I have shown how to write servlet for our need.
But we need to know the internal architecture that how it is fitting with global servlet architecture.
Look at the picture
So whatever servlet we need as per our need that extends to HttpServlet class.It is an abstract class which gave freedom to write HTTP Servlets.Now this class also extended to GenericServlet class with facility to Handel HTTP requests.So our servlet inherits all the methods (as per the picture 4) .
This is how our simple servlet is actually fitting into servlet framework arena.
The methods are--