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

Difference between get and post in java servlets?

0 Answers  


what is the advantage of using Servlets over CGI programming?

4 Answers  


How we can create war file in servlet?

0 Answers  


What are the different mode that servlets can be used?

0 Answers  


What is pure servlet?

0 Answers  






How do you invoke a Servlet? What is the difference between doPost method and doGet method?

0 Answers  


Which java application server is the best?

0 Answers  


List out the difference between ServletConfig and ServletContext?

0 Answers  


How to get ip address in jsp login page and how to validate like 127.1.0.1 all should not be greater than 255

0 Answers   Bosch, EF,


What is servlet used for?

0 Answers  


What is the type of method for sending request from http server?

0 Answers  


How many ways are available to ger RequestDispatcher object?

4 Answers   Polaris,


Categories