• Post Reply Bookmark Topic Watch Topic
  • New Topic

Constructor in Servlet  RSS feed

 
sahidul karim
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i create a constructor in a servlet and keep all initialization parameter in it and also define a default no-arg constructor then waht will happen? that constructor will intialize all the parameter ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container instanciates your servlets and it does it with a no arg constructor.

If you have both, the one with arguments will be ignored.
If you only have a constructor that requires arguments, the servlet will not be instanciated.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!