Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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 is Request Dispatcher?

1 Answers  


When servlet object is created?

0 Answers  


when the jsp page is translated to servlet?

5 Answers   HCL,


What is SingleThreadModel interface?

0 Answers  


What is the use of servlet context?

0 Answers  


Explain the steps involved in placing a servlet within a package?

0 Answers  


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

2 Answers   TCS,


can v create a constructor 4 servlet?

7 Answers   Satyam,


What is connection pooling?

4 Answers   Wipro,


How will you pass values from HTML page to the servlet?

0 Answers  


Which java application server is the best?

0 Answers  


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

0 Answers  


Categories