File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes how call the doGet method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "how call the doGet method" Watch "how call the doGet method" New topic

how call the doGet method

Markandey Sahu

Joined: Jun 29, 2006
Posts: 13
Hi all,
i have one question : i want to know who call the doGet method or doPost method container or service method.

answer is


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


The next method invoked is destroy.

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

Joined: Mar 27, 2004
Posts: 401
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?

Leandro Melo
SCJP 1.4, SCWCD 1.4
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
If I understand this right.

You could overwrite the service-method if you want a single method which handles the doGet, doPost, doPut.

Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
It rarely makes sense to override the service method: Servlet FAQ entry

Joined: Mar 27, 2007
Posts: 20
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

SCJP 95%<br />SCWCD(waiting for the big)
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
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.
I agree. Here's the link:
subject: how call the doGet method
jQuery in Action, 3rd edition