Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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 4 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 8 No

Post New Answer

More Servlets Interview Questions

How to get the actual path of servlet in server?

0 Answers  


Why servlet is used as controller ? Not JSP? I want complete explation?

0 Answers   Tech Mahindra,


In which cases Destroy() is invoked?

2 Answers  


What happens, when client requests for server object, which is not yet loaded into the memory?

2 Answers  


when will cookie information destroy?

7 Answers  






Hi Frieds, I am new to servlet why to use servlet in webapplication. what i know is " use servlet as a controller in mvc and to implemnent business logic . is it correct ? One more thing reason for implementing business logic with servlets , why not jsp.

4 Answers  


What is java servlet session?

0 Answers  


How can you create a session in servlet?

0 Answers  


What is the disadvantage of cookies?

0 Answers  


What’s the use of the servlet wrapper classes??

0 Answers  


How ThreadSafe page attribute will be working in Servlet as well as in JSP?Automatically ThresdSafe is true in JSP so service method will be destroy in each and every request or not?so how thresd will handle srevice method?

1 Answers   AZTEC,


I Have A Plan to develop a Project in Struts,I want the template of struts project with Hibernate.Canany body provide me the required information?

0 Answers   IBM,






Categories