What is difference between GET and POST method in HTTP protocol?

JSPJava 8Object Oriented ProgrammingProgramming

GET method

The GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the ? character as follows −


The GET method is the default method to pass information from the browser to the web server and it produces a long string that appears in your browser's Location:box. It is recommended that the GET method is better not used. if you have a password or other sensitive information to pass to the server.

The GET method has size limitation: only 1024 characters can be in a request string.

This information is passed using QUERY_STRING header and will be accessible through QUERY_STRING environment variable which can be handled using getQueryString() and getParameter() methods of the request object.

POST method

A generally more reliable method of passing information to a backend program is the POST method.

This method packages the information in exactly the same way as the GET method, but instead of sending it as a text string after a ? in the URL it sends it as a separate message. This message comes to the backend program in the form of the standard input which you can parse and use for your processing.

Updated on 30-Jul-2019 22:30:25