aspose file tools*
The moose likes Servlets and the fly likes Why only doGet()  or doPost() & not service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Why only doGet()  or doPost() & not service" Watch "Why only doGet()  or doPost() & not service" New topic
Author

Why only doGet() or doPost() & not service

Syed Khateeb
Greenhorn

Joined: Sep 30, 2006
Posts: 7
Why is it advised to override doGet()&/doPost() instead directly overriding service()?
Is it only because the possibility of having implementations for for other doXyz() methods is not possible?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

You can override other doXXX methods as well. Most of the time you can accomplish what you want the servlet to do using the doGet and doPost methods.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Chetan Raju
Ranch Hand

Joined: Aug 02, 2006
Posts: 109
By Overriding service() method, you need to implement logic to read the type of HTTP request (GET/POST). But, currently the service method already does this and dispatches the request to doPost()/doGet() method appropriately.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why only doGet() or doPost() & not service