This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 8904

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()
Similar Threads
HTTP Status 405 error comes
HTTP method GET is not supported by this URL
Method of javax.servlet.Servlet
Advantage of doGet method ?