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 a servlet is unloaded?
What is the need of session tracking in web application?
How to generate the server side programming and the advantages of it over the other languages?
Write a servlet to upload file on server.
How do we call one servlet from another servlet?
What is the use of attribute in servlets?
What are the exceptions thrown by servlets? Why?
Write all the phases defined in servlet life cycle?
What’s the difference between forward() and sendredirect() methods?
What is cookie in servlet?
What is a servlet engine?
How can the referrer and the target urls be used in servlet?
When jsessionid is created?
What is a web container and what is its responsibility?
What is the use of welcome-file-list?