What is the difference between Difference between doGet() and doPost()?



What is the difference between Difference between doGet() and doPost()?..

Answer / Roop Kishor

doGet() and doPost() are methods in Servlets used to handle HTTP requests. The main differences are:n
1. Request Data:n- doGet() gets request data from the URL query string.n- doPost() gets request data from the body of the HTTP request, which may be more secure as it's not visible in the URL.n
2. Encoding:n- GET requests are typically stateless and safe, so they should use ASCII characters only. If needed, special characters can be URL encoded.n- POST requests can handle more data and non-ASCII characters without being encoded.
3. Default Behavior:n- A new doGet() request is processed even if it's the same as a previous one (idempotent).n- A new doPost() request results in a new servlet instance (not idempotent).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Servlets Interview Questions

When Servlet is unloaded?

1 Answers  


what is EJB and Java servlet

2 Answers  


What are the kinds of http requests?

1 Answers  


can we override service method in my servlet class..?? if yes or no why ??

7 Answers   IBM,


Elucidate servlet attributes and its scope?

1 Answers  


What do you understand by mime type?

1 Answers  


What is pure servlet?

1 Answers  


how the server will know its the same jsp page?

3 Answers   HCL,


What is meant by a web application

1 Answers  


what is servlet chaining?

1 Answers  


How to read request headers from servlets?

1 Answers  


Why session tracking is needed?

1 Answers  


Categories