File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes doPost(), doGet() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "doPost(), doGet()" Watch "doPost(), doGet()" New topic

doPost(), doGet()

narender kaasam

Joined: May 15, 2006
Posts: 28
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()....
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

This has been answered many times in this forum. A search will help.

ak pillai
Ranch Hand

Joined: Feb 11, 2006
Posts: 288

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

java j2ee job interview questions with answers | Learn the core concepts and the key areas
I agree. Here's the link:
subject: doPost(), doGet()
It's not a secret anymore!