• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doPost and doGet

 
ranga shreya
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doPost and doGet methods differences
 
Ernesto Elias-Nieland
Ranch Hand
Posts: 53
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Ernie
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Eduardo Dela Rosa
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Cheers!
 
Scott Selikoff
author
Saloon Keeper
Posts: 4020
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ranga shreya:
doPost and doGet methods differences


Please try to be more specific in your question. Especially because as you phrased google could have answered it in about 3 clicks.
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The kind of http request that triggers the servlet service.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic