Hi Pankaj,
On the server machine, there is a servlet container, that receives the
request, sees which server resources you are talking about from the URL,
loads the class, instantiates the servlet object, creates ServletConfig
object to pass it to the init() method (called only once, suppose it is
first request), now to process the request creates two objects
HttpServletRequest and HttpServletResponse and passes them to the service
method. Sevlet creates a new
thread and new call state for each request is
used. Now service method decides what type of client request is. If it is GET, doGet and if it is POST doPost() method of the servlet is called.
Response is sent back to the client using response client that goes back
through the container. Before the response is sent, the content type of the
response is set using setContentType(...) method that tells the client
browser how to use that content.
Hope this much detail render some concepts.
Thanks,