Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

service method in httpservlet  RSS feed

 
Durgaprasad
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do we need to override doget method in httpservlet while writing a servlet. why can the service method call the doget method defined by httpservlet class. why are we forced to implement it. pls reply asap. I know doget method is protected but it will be still available for the service method?

SCJP 91
SCWCD preparing
ISDX preparing
 
Durgaprasad
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator







[BPSouther: added line breaks to quote]
[ October 03, 2006: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Durgaprasad,
Welcome to JavaRanch!

We're pleased to have you here with us in the servlets forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Service method isn't a abstract method.The code sitting in that method is used to delegate the reuqest to appropriate method according to the HTTP command (like GET , POST )which is there in the request.If you have some command specific code then override the specific command specific methods (to put code specific to GET command to doGet())to put appropriate code in those or if you have some generic code then you can override the service method directly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!