Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Syed Khateeb
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chetan Raju
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic