Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

doGet() and service() method

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all i have written two code in servlet as



Another code is


Both working fine code 1st having doGet() method while code 2nd having service() method then what is diffrence between them.

Regard
Arun
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By using doGet, doPost, or any of the other do___ methods you enable your servlet respond to different types of requests in different ways.

The default service method figures out which type of request has been made and delegates to the proper do___ method. Once you override it, you've erased that capability.

A simple rule of thumb is never to override the service method.
If you want post and get requests to behave the same have one call the other.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some more information is available in this FAQ entry.
 
Get off me! Here, read this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!