Answer Posted / 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 |
Post New Answer View All Answers
How do we share data using 'getservletcontext ()?
What is the use of java servlet api?
Differentiate between get and post?
Why is a constructor needed in a servlet even if we use the init method?
What are the types of servlets? Explain
How can we perform any action at the time of deploying the project?
What is session?
What is meant by a web application
Is tomcat a servlet container?
What is the effective way to make sure all the servlets are accessible only when user has a valid session?
What do you mean by chaining in servlet?
Difference between GET and POST?
What are the functions of Servlet container?
Why do we have servlet wrapper classes?
How does java thread pool work?