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

Why are http servlets used in programming?

524


Write a simple servlet program to print the contents of html.

525


What is url encoding and url decoding

566


Difference between doget and dopost?

662


Write a program to show the functionality of doget and dopost method?

626






I Have A Plan to develop a Project in Struts,I want the template of struts project with Hibernate.Canany body provide me the required information?

2208


Which http method is said to be non-idempotent and idempotent?

588


What are the differences between the servletconfig interface and the servletcontext interface?

555


Which java application server is the best?

521


How can we refresh automatically when new data is entered into the database?

581


Difference between get and post in java servlets?

522


Explain the features are in servlet 3?

573


What is difference between PrintWriter and ServletOutputStream?

742


How can we upload the file to the server using servlet?

524


Can filter be used as request or response?

528