how this statement works..?
public void service(HttpServletRequest
request,HttpServletResponse response)

Answers were Sorted based on User's Feedback



how this statement works..? public void service(HttpServletRequest request,HttpServletResponse res..

Answer / sanjeev kumar

When ever a http client request is sumbitted servlet engine
will received this request and it identifies the proper
servlet to handle this request from web.xml and calls the
public service method of the perticular servlet. Internally
this public service will call the private service method
and private service method will call the doGet() or doPost
() method based on the client request. This public void
service(HttpServletRequest request, HttpServletResponse
response) will be called once per the request.

Is This Answer Correct ?    11 Yes 0 No

how this statement works..? public void service(HttpServletRequest request,HttpServletResponse res..

Answer / shubha

1.servlet container calls the service(servletreq,
servlrtResp) method of HTTPServlet.
2.the service(ServletReq, ServletResp) method of
HTTPServlet calls the service(HttpServletReq,
HttpServletResp) method of the same class. in this service
method is overloaded in the HttpServlet class.
3.service(HttpServletReq, HttpServletResp) mthos alayse the
request and findout which HTTP method is being
used.Depending on Http method appropriate doXXX() mthod
will be call.

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More Servlets Interview Questions

Explain mvc pattern.

0 Answers  


How the JSP file will be executed on the Server side?

0 Answers   Cap Gemini,


How can we perform any action at the time of deploying the project?

0 Answers  


how to pass parameter from servlet to html form

4 Answers  


What is dispatcher servlet?

0 Answers  






How to pass a requrest object of one servlet as a request object to another servlet?

4 Answers   Verizon,


Which http method is said to be non-idempotent and idempotent?

0 Answers  


Can I override destroy() method of Servlets?

4 Answers   Accenture,


Write a command to get actual path of a servlet to the server?

0 Answers  


What is the servletconfig object?

0 Answers  


What are the life-cycle methods for a servlet?

0 Answers  


Explain the servlet filter.

0 Answers  


Categories