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...

Can we define constructors in Servlet?

Answer Posted / vivekanand prasad

The init() method creates and loads the servlet.But the servlet instance is first created through the constructor (done by Servlet container). We cannot write constructors of a servlet class with arguments in servlet (It will throw Exception). So, They provided a init() method that accepts an ServletConfig object as an argument.ServletConfig object supplies a servlet with information about its initialization (init) parameters.Servlet class cannot declare a constructor with ServletConfig object as a argument and cannot access ServletConfig object.

Is This Answer Correct ?    20 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What if the static modifier is removed from the signature of the main method?

1181


What is re-entrant. Is session beans reentrant. Is entity beans reentrant?

1017


What is abstract schema?

969


Why are my checkboxes not being set from on to off?

1085


which book is better for jdbc ,servlets and jsp

2049


What are the difference between RMI and CORBA?

1057


What is TL and its use?

2408


Name three component subclasses that support painting?

1019


What are callback interfaces?

1051


how to make a index.jsp for running the site in internet and find an error for connection with weblogic server and java that give an error invalid object name.and how to maintain session.

2203


To what value is a variable of the string type automatically initialized?

1080


How to deploy Jar, War files in J2EE?

2622


How to implement RMI in Java?

2832


Is it possible to stop the execution of a method before completion in a sessionbean?

1028


What are local interfaces? Describe.

1161