my dog learned polymorphism*
The moose likes Servlets and the fly likes servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlets" Watch "servlets" New topic
Author

servlets

praveena reddyk
Greenhorn

Joined: Sep 25, 2008
Posts: 11
The Syntax of HttpServlet service() method is like overloading the
service() method of GenericServlet so which class is implementing the
service() method of Servlet Interface.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5
Learn to use the JavaDocs to answer such questions.
Here is one starting point.

Bill
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Hi praveena reddyk welcome to Javaranch ,
The topic title "servlet" in a forum dedicated to servlets isn't much meaningful. Please make it more descriptive. Read this for more information.

I am not getting your question here, will you please give some details.


SCJP, SCWCD.
|Asking Good Questions|
praveena reddyk
Greenhorn

Joined: Sep 25, 2008
Posts: 11
Originally posted by Amit Ghorpade:
Hi praveena reddyk welcome to Javaranch ,
The topic title "servlet" in a forum dedicated to servlets isn't much meaningful. Please make it more descriptive. Read this for more information.

I am not getting your question here, will you please give some details.
praveena reddyk
Greenhorn

Joined: Sep 25, 2008
Posts: 11
Originally posted by Amit Ghorpade:
Hi praveena reddyk welcome to Javaranch ,
The topic title "servlet" in a forum dedicated to servlets isn't much meaningful. Please make it more descriptive. Read this for more information.

I am not getting your question here, will you please give some details.



Hi Amit,
My question is GenericServlet is having an abstract service() method and HttpServlet class is extending the GenericServlet but the service() method in HttpServlet is having HttpServletRequest and HttpServletResponse as parameters so it is overloading version of GenericServlet service() method. since HttpServlet is defined as abstract it is still having the service() method of GenericServlet without implementation. if we write our own servlet we are overidding the HttpServlet Service() method. so my question is who is implementing the GenericServlet service() method.
Kuladip Yadav
Ranch Hand

Joined: Jul 30, 2008
Posts: 162

Hi,

so my question is who is implementing the GenericServlet service() method.


the answer is HttpServlet.
This class implments service method of GenericServlet


which in implmetation call



And that service method call doGet, doPost etc method.

so dont care about service method HttpServlet will take care of it.

So you have to overrid doGet(), doPost() methods only

See the api
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

As you can see from the API documentation, service() method in GenericServlet is abstract, so the class extending GenericServlet must implement that method.
For HTTP servlets, the HttpServlet class implements that method.
 
 
subject: servlets
 
Similar Threads
Post to Servlet from Applet doesn't work
protected Method service???
Did implicit objects are instance variables or local variables in _jspService
Web service method call behaviour?
service() in HttpServlet