• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how call the doGet method

 
Markandey Sahu
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
i have one question : i want to know who call the doGet method or doPost method container or service method.

answer is
[code]
Answer


C)

This code is valid and will handle all three types of HTTP requests including GET, POST, and PUT.

D)

The next method invoked is destroy.

[/code}
i don't have problem with second answer [d] but i have problem with choice [c] please clear it.
thanks in advance
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Markandey.

The service method is the one responsible to call doGet, doPost, doPut, depending on the request type. In this case, it is just not calling these methods (but it's handling the requests anyway). Is it clear?
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand this right.

You could overwrite the service-method if you want a single method which handles the doGet, doPost, doPut.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It rarely makes sense to override the service method: Servlet FAQ entry
 
D.R.Vinayak
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no Hard and fast rule to override service method if you extend HttpServlet.Since service method implementation is provided in HttpServlet class.Container will call this service method if you don't override it.
Here there is logic which will call your doXxx() methods depending on its method type.If your overriding service method you are telling the container please call my service method rather than service method of HttpServlet class
please correct me if i m wrong
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no Hard and fast rule to override service method

True, but there are good reasons not to do so; the FAQ entry lists two of them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic