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

Write the code to get the server information in servlet.

0 Answers  


Does servlet have main method?

0 Answers  


waht is the main diference b/w servelts and JSP ?

8 Answers   CAP, HCL,


Is classes folder is compulsory in web-inf/ even though u r deploying ur application with war file?

3 Answers   Bosch, Cognizant,


When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?

0 Answers  


Is it possible to call servlet with parameters in the URL?

4 Answers  


What is the difference between context parameter and context attribute?

0 Answers  


What exactly is a servlet?

0 Answers  


What are the common methods that are included in the http servlet class?

0 Answers  


What is the difference between RequestDispatcher and sendRedirect?-

5 Answers   CTS,


what is the difference between Servlet and JSP?Advantage of JSP over Servelt?Any concept present in JSP which we cant implement in Servlet?

31 Answers   ABC, Apere, AZTEC, CTS, CybAge, iFlex, Impact Systems, Sara, TCS,


What’s the difference between sendredirect and forward methods

0 Answers  


Categories