• 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

can servlets have constructor

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
can servlets have constructor?
i know that servlets have constructor that is provided by the container

what happens if we provide the constructor?
i know that if we provide constructor, you are voilating the container rule.

i want to voilate the container rule ? what happens if we provide constructor?
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

can servlets have constructor?



Servlet is a Java Class , so it has to have a constructor (either default or programmer defined ).

what happens if we provide the constructor?
i know that if we provide constructor, you are voilating the container rule.

i want to voilate the container rule ? what happens if we provide constructor?
[jumpingjoy] [jumpingjoy]



Why don't you try this and tell us what container says !
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by maheswari kris:
i know that servlets have constructor that is provided by the container

No, it doesn't. Servlets are java classes like any other and just like any other class, if you do not provide a constructor, a default constructor is created. It has nothing to do with the container.
[ July 30, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, please be sure to check the Servlets FAQ before posting to see if your question, like this one, has already been addressed.
[ July 30, 2008: Message edited by: Bear Bibeault ]
 
Seriously Rick? Seriously? You might as well just read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic