File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes doGet and doPost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "doGet and doPost" Watch "doGet and doPost" New topic
Author

doGet and doPost

Nilesh Srivastava
Ranch Hand

Joined: Aug 29, 2003
Posts: 70
Hi All..
What is the difference between doGet and doPost.and
When we post a form, which form is called doPost or doGet.
Thanks
Nilesh
Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
Hi Nilesh,
Here is a good explanation :
Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
Hi Nilesh,
Here is a good explanation : http://www.coderanch.com/t/348803/Servlets/java/Difference-bet-doGet-doPost
Gayan Balasooriya
Ranch Hand

Joined: Jul 31, 2002
Posts: 51
Here's another good explanation from
http://www.esus.com/javaindex/j2ee/servlets/servletdogetdopost.html
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.

Gayan Balasooriya
SCJP,SCWCD
http://www.gayanb.com - Free Java/J2EE/J2ME books and mock exams
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doGet and doPost
 
Similar Threads
What is max size of the Data in request?
POST or GET
doGet and doPost
doPost and doGet
doGet() & doPost