aspose 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

Win a copy of The Software Craftsman this week in the Agile forum!
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="" target="_blank" rel="nofollow"></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="" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="" target="_blank" rel="nofollow">SCWCD Group</a>
Have you tried LearnNowOnline?
subject: doGet and doPost