What is the use of Service() in servlets? How is that method invoked?

Showing Answers 1 - 24 of 24 Answers

siri

  • Sep 21st, 2007
 

service() method is used for processing of requests and this is invoked by the servlet container

fcasttro

  • Nov 21st, 2007
 

The service() method is available in the Generic servlet and this is used to serve the client request. This method is invoked by the servlet container.

  Was this answer useful?  Yes

sampra

  • Feb 13th, 2008
 

The service() method is available in the Generic servlet and this is used to serve the client request. This method is invoked by the servlet container

  Was this answer useful?  Yes

barathalam

  • Feb 25th, 2008
 

The container initializes the servlet instance by calling the init .After completing the initialization it calls the service () method passing servlet request and response objects as parameters. service () method is designed in such a way the depending on type of the request method it calls the either doGet() or doPost() method. There is no need to make a explicit call to doGet () or doPost() method.

  Was this answer useful?  Yes

sasikumarnp

  • Jul 25th, 2009
 

Service method is used to process client request, and generate the dynamic content. This method is invoked by the container when the client request reaches the web container.

  Was this answer useful?  Yes

When init() method returns successfully then only service() method is called by the servlet container.This method handles each new request coming from the client and new thread is created in the same process.

Depending upon the type of request either get/post, the service method calls appropriate method doGet() or doPost() to response the client request.

  Was this answer useful?  Yes

service method is used to serve to client [which intern calls doGet/doPost methods depending on type of requests].......
This service() method is called by the servlet container....

Thanks,
Vinay

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions