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 / archana

When u create a servlet with a constructor it wont be a
complete servlet but will be in a akward state where it
cannot access Servlet Context and Config.It has to go
through the init() method (though we dont know what code is
written there) to be a complete servlet

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 servlet in tomcat?

1008


Why don't we write a constructor in a servlet?

994


What is the dispatcher servlet?

926


What do you mean by servlet?

1104


Which are the different ways you can communicate between servlets?

945


Does servlet have main method?

1136


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

1029


What is session tracking?

1149


What is a servlet engine?

971


What is the use of httpservletresponsewrapper?

914


What are the differences between forward() method and sendredirect() methods?

973


What is a generic servlet?

902


How does java thread pool work?

1023


What is the use of request dispatcher interface?

963


Explain url encoding in servlet?

998