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 v create a constructor 4 servlet?

Answer Posted / chandra kunchala

yes ofcourse we should.
it is mandatory for servlet.
for servlets we required publc no argument constructor. if v
don't having that one, our servlet should not work, even
though if you are not crating the public no-argument
constructor, the java compiler will take the responsibility
to create public no- argument constructor.. mean while your
servlet should be public otherwise you will get
RuntimeException.


we can create costructor for sevelet but it should b no-
argument constructor. and u r servlet should be public.
and one more thing this constructor in not in the place of
init() method..

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is context in servlet?

1043


How to notify an object in session when session is invalidated or timed-out?

1086


How is an application exception handling is done using a servlet?

1022


Describe servlet?

1046


When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?

1106


What do you mean by servlet?

1147


How do we go with database connection and log4j integration in servlet?

1175


What's the servlet interface?

1085


Explains the differences between context.getrequestdispatcher() and request.getrequestdispatcher()?

1040


What are the common methods that are included in the http servlet class?

1043


Does servlet have main method?

1193


Why servlet is mostly used?

1246


What is a web container and what is its responsibility?

982


How can I send user authentication information while making URL Connection?

1006


Explain how does JSP handle run-time exceptions?

1097