• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

doPost and doGet

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
doPost and doGet methods differences
 
Ranch Hand
Posts: 53
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The kind of http request that triggers the servlet service.
reply
    Bookmark Topic Watch Topic
  • New Topic