What are the parameters of the service method ?

Answers were Sorted based on User's Feedback



What are the parameters of the service method ?..

Answer / chadnra kunchala

well, there are two service methods we have.
one is, public service()
second is protected service()

when ever a browser sends a request to server, first it
invokes public service(ServeletRequest req, ServletResponse
res) throws ServletException, IOException
{ }
after calling public service method it invokes the protected
service() method like the following
public service(ServletRequest req, ServletResponse res)
throws ServletException, IOException
{
HttpServletRequest hreq = (HttpServletRequest)req;
HttpServletResponse hres = (HttpServletresponse)res;
protected service(hreq, hres);
}
then,
The protected service() method will idendtify the
requested method whether it is GET OR POST OR PUT like that
, then it invokes the correspondin method like doGet()or
doPost() or doPut() like that..

recommended to override doGet() or doPost() or and..... so
on, not service method()..

Is This Answer Correct ?    10 Yes 5 No

What are the parameters of the service method ?..

Answer / shakir khan

service() method called servlet to handle client request in
a new thread.service() method accepts ServletRequest and
ServletResponse objects as parameters.ServletRequest object
contains client requests.It contains data sent in
name/value pairs.

ServletResponse object is used to send the respose to the
client.

public void service(ServletRequest req,ServletResponse res)
throws ServletException,IOException
{
}

Is This Answer Correct ?    10 Yes 10 No

Post New Answer

More Servlets Interview Questions

What are the methods in HttpServlet?

8 Answers  


How many objects of a servlet is created?

0 Answers  


What is the use of httpservletresponsewrapper?

0 Answers  


What is servlet used for?

0 Answers  


What are the classes and interfaces for servlets?

4 Answers  






Explain servlet.

0 Answers  


In which cases Destroy() is invoked?

2 Answers  


What are its drawbacks of cgi?

0 Answers  


What is the major difference between context parameter and context attribute?

0 Answers  


Explain their methods? Tell me their parameter names also have you used threads in servlet?

0 Answers  


What is a servlet?

0 Answers  


Explain url encoding?

0 Answers  


Categories