Question:
What is the diff b/w doGet() and service() method?
Answer:
Well the service method tries to determine which of the doXXX method needs to be called.Appropriately either doGet, doPost, doDelete, doPut etc etc are called, Source: CoolInterview.com
1-doGet()can pass text up to 2k while doPost()pass carry large of test. 2-doGet() show the data in url so client can know whats data is passing like this http://www.red/myservlet?name="....." . while in doPost() data pass in stander format called "marsy format" the passing data not stor in string but it stored in request so user can not know which data is passing. 3-doGet() can handel only coming doGet()request while doPost() can handel both doGet and doPost() request. Source: CoolInterview.com
Answered by: Arvind | Date:
| Contact Arvind
Service() method is life cycle method, where as doGet() /doPost() kind of methods are protocol (http)specific methods.Servlet serves client means service() methods gets call 100% ,this method in turn calls protocol specific method Source: CoolInterview.com
Answered by: gswat | Date: 1/5/2008
| Contact gswat
when a request is made wherein Http GET method is used,the servlet is invoked by the Web container which is responsible for calling respective Servlet. Upon receiving the request by the container, servlet's service method is called.Now depending on the type of http method i.e GET or POST doGet or doPost method is invoked by the container. Source: CoolInterview.com
Answered by: sandip | Date: 5/22/2008
| Contact sandip
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|