What is the difference between Service, doGET, doPOST methods in a servlet.which one will be used when?

Questions by vijaykumar_rjp

Showing Answers 1 - 9 of 9 Answers

satish

  • Nov 7th, 2006
 

when we make a request to any servlet, request doesn't goes directly to the servlet instead it will go to the service method of the super class and then it was passed as a parameters to the service method of ur class.In doGet() method the data will append to the url as a querrystring and we can't send huge amount of data using doGET() method. Where as in doPost()method the data can be directly sent to browser without displaying it in the url.withis we can send as much of data as we can.But doGet() method is little faster when compared to doPOst().but it is not recommended as for some sensitive messages like password will be displayed as a querrystring in it.

  Was this answer useful?  Yes

rajkumar

  • Nov 7th, 2006
 

Service() method designed in such a way that depending up on type of the method it calls either doGet() or doPost() mehtod .doGet() method is preferred to used when we want to send the small amount of data and doPost() mehtos is used when we want to send secure data.with doGet() the amount of data is limited where as with doPsot() the is no such limit on the data. In doGet() the data is exposed to the end user so that he can make bookmark that page and later it may possible to visit that page.where as with doPost() the data is sent through the body of the request.If u over ride the service method it may not function perfectly. in such a case we have to findout the request method and explicitly call the doXXX() method(either doGET or doPOST)

  Was this answer useful?  Yes

Hi
 An HTML form has an attribute called "METHOD" that defiines how the date will be send to the server!.
The GET method appends the data to teh URL and sends it to server that way!
The POST method bundles the data in packet and sends the pkt of data to the server.

GET : No security,less data is transferred, but easier !
Generally doPOST or service is used!

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions