Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Hi guys.. Well can u tell me that why there is need of
"init()" , i mean why can not we initialize the servlet object
with the help of constructors?
Thank you.

Answer Posted / manas banerjee

you can use but should not.the original reason for init()
was that ancient version of java could not dynamically
invoke constructors with arguments.so there was no way to
give the constructors a ServletConfig.So u would not have
to access to ServletConfig or ServletContext.

{{in short:init() has access to servletconfig and
servletcontext object constructor would not..

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is called servlet mapping?

1070


Can you create a deadlock condition on a servlet?

1078


When should you prefer to use doget() over dopost()?

1147


Where do you define dispatcherservlet?

1048


Can you send an authentication error from a servlet?

965


What do you mean by a filter and how does it work?

938


Which exception is thrown if the servlet is not initialized properly?

1020


Which application server is best for java?

1061


Why servlet is mostly used?

1232


Define context initialization parameters.

1028


Why do we need a constructor in a servlet if we use the init method?

1037


What is servlet invoker?

1034


What do you mean by default initialization in java servlet?

1093


What is the use of java servlet api?

1029


How to get the path of servlet in the server?

1005