This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

just use doget()  RSS feed

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when we make a servlet in eclipse it makes doget() and dopost() only. isnt its necessary to use service() in a servlet??
 
Sheriff
Posts: 23640
48
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Using the service() method is bad practice. If you want your servlet to respond to GET requests then you should implement the doGet() method, and if you want it to respond to POST requests then you should implement the doPost() method. That's what those two methods are for, so just using service() is sloppy.
 
Saloon Keeper
Posts: 4690
117
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It also violates the HTTP specification which states that GET and POST serve different purposes and should not be used interchangeably. Certain IDEs (NetBeans in particular) proliferate this bad practice by generating boilerplate code that makes it seem as if both are identical - very much not so.
 
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And it's doGet(), not doget(). Case matters.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!