Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between doGet() and doPost() in term of the flow? [duplicate]

Tags:

java

servlets

the difference in term of the flow, i know that doGet() is the pre-processing and dopost is post-processing, but what is that?

like image 531
shamil khairi Avatar asked Nov 20 '14 13:11

shamil khairi


1 Answers

This link Detail

doGet() and doPost() are HTTP requests handled by servlet classes.

In doGet(), the parameters are appended to the URL and sent along with header information. This does not happen in case of doPost(). In doPost(), the parameters are sent separately. Since most of the web servers support only a limited amount of information to be attached to the headers, the size of this header should not exceed 1024 bytes. doPost() does not have this constraint. Usually programmers find it difficult to choose between doGet() and doPost().

doGet() shall be used when small amount of data and insensitive data like a query has to be sent as a request. doPost() shall be used when comparatively large amount of sensitive data has to be sent. Examples are sending data after filling up a form or sending login id and password.

like image 189
Benjamin Avatar answered Oct 07 '22 01:10

Benjamin