What is the difference between doGet and doPost?

Answer Posted / shivani

doGet is used when there is are requirement of sending data appended to a query string in the URL. The doGet models the GET method of Http and it is used to retrieve the info on the client from some server as a request to it. The doGet cannot be used to send too much info appended as a query stream. GET puts the form values into the URL string. GET is limited to about 256 characters (usually a browser limitation) and creates really ugly URLs.

doPost allows you to have extremely dense forms and pass that to the server without clutter or limitation in size. e.g. you obviously can't send a file from the client to the server via doGet. doPost has no limit on the amount of data you can send and because the data does not show up on the URL you can send passwords. But this does not mean that POST is truly secure. It is more secure in comparison to doGet method.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is httpservlet and how it is different from genericservlet?

601


What are the uses of servlet and what is servlet chaining?

559


What is the use of welcome-file-list?

569


What do you mean by a filter and how does it work?

535


Explain session tracking and its importance?

544






What’s the difference between sendredirect and forward methods

564


What is difference between server and servlet?

575


What are the steps that are involved in using the httpservlet class?

572


What is the use of servletconfig interface?

554


Explain in brief the directory structure of a web application?

566


How do you get the ip address of the client in servlet?

551


What is the workflow of a servlet?

719


Is servlet a framework?

539


What are the different mode that servlets can be used?

549


What methodology can be followed to store more number of objects in a remote server?

1815