• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

servlet constructor

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends,
I would like to know why the servlet doesnot have a
constructor.
A brief explanation is needed, the orielly servlet book
doenot give a satisfactory reason.
thanks in advance.
regards
- mohan
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A servlet may have a constructor, but only one which takes no parameters. This is because servlets are dynamically loaded by the servlet container as needed, and the classloader can't know what other parameters you might want to pass to the constructor, or where to get them from.
This is the same with all dynamically loaded classes, which is why the idiom of a user-supplied "init" function is so common in Java APIs.
 
reply
    Bookmark Topic Watch Topic
  • New Topic