Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

doPost(), doGet()

Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one could explain me When doGet(), doPost() methods we need to write ?
I know these things.
When client send a request through "Get" method, doGet() method will be called , for "post", doPost() will be called.Except this in servlet when we need to write doGet() or doPost()....
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has been answered many times in this forum. A search will help.
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The request parameters are transmitted as a query string appended to the request. Allows browser bookmarks but not appropriate for transmitting private or sensitive information.

GET was originally intended for static resource retrieval.

GET is not appropriate when large amounts of input data are being transferred.


The request parameters are passed with the body of the request.
More secured.

POST was intended for input data submits where the results are expected to change.

Conclusion: Prefer using doPost() and in doGet() you can call doPost() method.

-- Excerpt from the book Java/J2EE Job Interview Companion
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic