jQuery in Action, 3rd edition
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

doGet and doPost

Sree kanth
Ranch Hand

Joined: Feb 02, 2005
Posts: 53
hi all

Why do we require two methods (doGet and doPost)for handling HttpServletRequest (get aswellas post)


Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
HTTP/1.1 defines a list of methods, each for different purposes.
Refer HTTP/1.1

Generally, you use GET when you want to retrieve a resource and POST when you must "post" information back to server.

SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
Raghu Shree
Ranch Hand

Joined: Mar 18, 2005
Posts: 143
And also if your form is submitted as get, doGet() method is executed in servlet and if your form is submitted as post, doPost() method is excuted.

Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: doGet and doPost
It's not a secret anymore!