Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

doPost and doGet  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42974
76
  • 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?
 
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!
 
author
Posts: 4099
21
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.
 
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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!