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 are the supporting protocol by HttpServlet ?

1258


What is the difference in between the httpservlet and generic servlet?

1187


What do you mean by filter in servlet?

1066


What is the process for chaining servlet?

1106


What do you mean by request dispatcher in servlet? Also explain its methods.

1214


What do you mean by servlet context?

1230


How do you design microservices?

1155


What are the life cycle methods of a servlet?

1099


What is servlet mapping?

1079


Explain web application directory arrangement?

1144


How do you run a servlet?

1108


Whether thread can be used in servlets?

1263


What is the difference between Server and Container?

1310


What is the use of servlet context?

1105


When should you prefer to use doget() over dopost()?

1226