esuslogo
 [To advertise Java(tm) Events here, contact joris@esus.com!]
banner

Java™
by example!






New @ Esus.com


  gb  In-house search engine for better results!

  gb  Get updates with the esus.com
newsletter!









  Home 
 Browse Categories 
 Ask a Java Question 
 Help 
  For Java Tips & Tricks, subscribe to the esus.com newsletter!
Search Java Q&A, Links, API's:   adv 

What is the difference between the doGet and doPost methods?
When you invoke a Servlet, the servlet engine passes the information on to the Servlets service() method. This method determines the type of request made (GET, POST, HEAD, ...) and calls the function doTYPE, like doGet, doPost. GET and POST just differ in the way form data is sent from the browser to the server. The method doGet handles data that has been attached to the url in the form url questionmark (name=value ampersand)+. Typically in a CGI you would have to read the environment variable QUERY_STRING to get this string of concatenated parameternames and values. With the doPost method, form data comes in through standard input stream, a cgi would just need to open the input stream and read until EOF to get the form data.

With Servlets, you don't need to read in the concatenated string of parameternames and values. The parsing is all done behind the scenes. You just need to call getParameter regardless of how the form data is actually sent in.


Further Information
Author of answer: Joris Van den Bogaert

Comments
Comments to this answer are only viewable by members. Login or become a member!





Terms of Service | Privacy Policy | Contact

Copyright © 2000-2003 Esus.com - All Rights Reserved 
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. Esus.com is independent of Sun Microsystems, Inc. All other trademarks are the sole property of their respective owners.