1

Possible Duplicate:
Servlets: doGet and doPost

I know doGet() request is appended to the request URL in a query string.But I don't know the concept of doPost() request.how does doPost request posting information to the server.

Please Guide me to get the working concept of doPost request...

Community
  • 1
  • 1
Saravanan
  • 11,372
  • 43
  • 143
  • 213

4 Answers4

2

Post requests are used usually for sending data to Server, and get request for reading data from server. In Post request data is sent in http request body, so data size can be very large compared to Get. If a browser fires an POST request (usually a form submit) doPost of the mapping Servlet will be called. There is another overloaded method (service()) which is called for both GET and POST

Subin Sebastian
  • 10,870
  • 3
  • 37
  • 42
1
  1. In doPost() the data is not appended in the URL.

  2. It can handle large amount of data compared to the doGet() method.

  3. Filling of form and submitting is done through doPost(), it's secure to use doPost() during submission of the username and password.

  4. There is also differnce in the doGet() and doPost() header and body structure.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Kumar Vivek Mitra
  • 33,294
  • 6
  • 48
  • 75
0

doGet() can be used when client request doesn't intend to change stored data.

Filip Roséen - refp
  • 62,493
  • 20
  • 150
  • 196
0

The main conceptual difference GET and POST is that, GET is used for getting the data from the server, and POST is used for updating the data to the server.

In general POST has the following properties:

  • The data is x-www-form-urlencoded . Which means, the request parameters are sent as request body. And the server has to parse the request body for parameters.
  • By default, when no content-length header is present, the default value for GET is 0 whereas for POST it is till end of stream.
  • GET is Idempotent whereas POST is Non-Idempotent. i.e, Proxies on failures for GET they retry. But, for POST they do not retry.
Ramesh PVK
  • 15,200
  • 2
  • 46
  • 50