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 the war file?

1024


What is the difference between get and post methods?

994


Explain the difference between servletconfig and servletcontext in servlet?

1004


What is ServletConfig object?

1123


What is life cycle of Servlet?

1028


Hi frnd can i any one kindly can post for me portlet,hibernate and spring example application and with flow explantion configuration using Jdeveloper.and related links ar tutorials kindly please send me .its urgent for me .thanks in advance...........else can any one send to kondaiah.goddeti@gmail.com

2141


Why servlet is used as controller ? Not JSP? I want complete explation?

1095


What do you mean by singlethreadmodel interface?

1006


What is the difference between portlet and servlet?

949


What is the GenericServlet class?

1175


How can we perform any action at the time of deploying the project?

1078


What is the need of session tracking in web application?

986


What is http servlet? Explain with the help of an example.

1029


When to use doget() and when dopost()?

1055


What is the major difference between context parameter and context attribute?

1061