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 write a constructor for a Servlet class ? if yes how ?
if no why not ?

Answer Posted / tharun raj

yes, we can provide a constructor in servlet calss..
Webcontainer uses the similar code shown below for creating
servlet object for our servlet class

Class c=Class.forName("OurServlet");
Object o=c.newInstance();

this newInstance() method uses zero argument constructor
while creating object..

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain url encoding?

996


How do we share data using 'getservletcontext ()?

1050


What are the supporting protocol by HttpServlet ?

1201


What is the advantage of Servlets when compared with other server side technologies?

2347


What is the difference between CGI and Servlet?

1080


What is servlet api used for conneting database?

1234


How do I use cookies to store session state on the client?

971


Difference between forward() method and sendredirect() method ?

1042


What is meant by cookies?

1082


List out difference between a JavaBean from a Servlet?

1037


What are different Authentication options available in Servlets.

1073


What are the servlet events?

1055


Explain the features are in servlet 3?

1054


How to get the actual path of servlet in server?

1225


What's the servlet interface?

1084