wood burning stoves 2.0*
The moose likes Servlets and the fly likes Init() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Init() " Watch "Init() " New topic
Author

Init()

rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
In Servlet,
In Servlet Interface which has method name is called Init(ServletConfig con),
In Generic Servlet Abstract class has Init() method.
What is the difference of the both?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

The answer is in the API.


[My Blog]
All roads lead to JavaRanch
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61316
    
  66

This is covered in the Servlets FAQ. Please be sure to check the FAQ before posting questions that have already been covered.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jasson jasson
Greenhorn

Joined: Oct 20, 2007
Posts: 6
Originally posted by rex tony:
In Servlet,
In Servlet Interface which has method name is called Init(ServletConfig con),
In Generic Servlet Abstract class has Init() method.
What is the difference of the both?


HI:
First,Servlet Interface is a interface,the method in Servlet is only a
declare.Generic Servlet implements Serlvet interface,so it must implement
all the methods in Servlet.So,Init() method in Servlet or Generic Servlet,one is declare,the other is implement;
wang jiajian
Greenhorn

Joined: Sep 20, 2007
Posts: 9
please google adapter
wang jiajian
Greenhorn

Joined: Sep 20, 2007
Posts: 9


when we wan`t use one method() of interface A like c(),but i don't want implment all method().

so you need a adapter to implment all method of interface A,the method in adapter do nothing like

when we have one adapter ,you can extend it and overriding thr method which you wan`t use.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"jasson jasson",
Please check your private messages


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
GeeCON Prague 2014
 
subject: Init()