Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can i called the constructor in servlet file?If Yes how can?If no why?

 
dev pandya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can i called the constructor in servlet?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A servlet is a Class, so yes you can call the constructor. The servlet is designed to run inside a container, however, and the container only knows how to interact with the servlet in certain ways, and it also expects the servlet to behave in particular ways in response to those interactions.

Servlets are not supposed to use constructors, so while while it is valid it is not really a 'servlet' thing to do.
[ June 11, 2008: Message edited by: David O'Meara ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic