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
What is the difference between sendredirect() and forward() in a servlet?
What are the different session tracking techniques?
What is cgi and what are its drawbacks?
When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?
What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?
Where do you define dispatcherservlet?
What is a servlet context?
What is the dispatcher servlet?
How is an application exception handling is done using a servlet?
Why do we need a constructor in a servlet if we use the init method?
What is a java servlet?
How can you start a jta transaction from a servlet deployed on jboss?
How do I know if java is running on linux?
Servlet is pure java object or not?
How servlet is created?