This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi! The difference is that in a POST request the request parameters are sent inside the http header. In a GET request the request parameter are added to the end of the url. For example: www.javaranch.com?parameter=aValue
0x2B | ~0x2B
SCJD, SCJP 1.5, SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJA, IBM Test 150, 142, 700, 701, Oracle Test 1Z0-51
Ummm, I think with a POST, the HTML form parameters are sent in the HTTP body, not the header.
But you're asking about doGet and doPost, not GET and POST. The only difference is that one is called as result of a GET, the other as result of a POST, which the javadocs of those methods probably already told you, so this isn't very helpful. Could you elaborate a bit more on what you'd like to know?
Originally posted by ranga shreya: doPost and doGet methods differences
Well, basically doPost is invoked by the Servlet's service method if it finds that the method used in the form to submit the request is "POST". The doGet is invoked if the request is submitted using the "GET" method.
Although both method in your servlet (doPost and doGet) can invoke common private method to process your request and response object, one basic difference is how the parameters are transmitted to the server (discrete or not, etc).
Instance where doPost would be invoked in the service method:
Likewise, when you use POST, form parameters are contained in the "body" of the HTTP message request, and not in the HTTP message header. This makes the values you submit a bit more secure that using GET method because they are not shown as part of the URL.