A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Badass: Making Users Awesome
this week in the
Why only doGet() or doPost() & not service
Joined: Sep 30, 2006
Oct 07, 2006 01:26:00
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?
Joined: Feb 24, 2006
Oct 07, 2006 02:04:00
You can override other doXXX methods as well. Most of the time you can accomplish what you want the
to do using the doGet and doPost methods.
SCJP 6 articles
SCJP 5/6 mock exams
More SCJP Mocks
Joined: Aug 02, 2006
Oct 07, 2006 03:16:00
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:
subject: Why only doGet() or doPost() & not service
When a request is sent to the servlet
Why Not Overload Service Method.
Multi-threading in servlets
why we should not override service() method in a servlet
Differences Between doGet(),doPost(),service()
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015