aspose file tools*
The moose likes Servlets and the fly likes doPost and doGet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "doPost and doGet" Watch "doPost and doGet" New topic
Author

doPost and doGet

ranga shreya
Greenhorn

Joined: Mar 05, 2005
Posts: 20
doPost and doGet methods differences


Thanks,<br />Ranga.<br />Life is precious so enjoy the life each moment and utilise it at the same time.
Ernesto Elias-Nieland
Ranch Hand

Joined: Sep 01, 2005
Posts: 53

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


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
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41874
    
  63
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?


Ping & DNS - my free Android networking tools app
Eduardo Dela Rosa
Greenhorn

Joined: Apr 15, 2004
Posts: 25
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!


Eduardo dela Rosa<br />SCJP 1.4
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

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.


My Blog: Down Home Country Coding with Scott Selikoff
Jaime M. Tovar
Ranch Hand

Joined: Mar 28, 2005
Posts: 133
The kind of http request that triggers the servlet service.


She will remember your heart when men are fairy tales in books written by rabbits.<br /> As long as there is duct tape... there is also hope.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doPost and doGet