• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet init() vs constructor

 
rinku jain
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.....

I have a doubt that why be need init() method in servelt if

all the initialization can be done within the constructor???
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey pard, you're here to get help, right? Well, a descriptive subject will do a lot more to attract the attention of the awesome volunteers here at the Ranch who can help you out! A simple title like "servelts" which isn't even spelled correctly doesn't really make your post stand out and say "Read me!"

And as you've create another post with the same subject, how are we supposed to tell the difference? I've changed the subject for you.

Take a gander at this FAQ ⇒ UseAMeaningfulSubjectLine ⇐ for more info.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This particular question has been asked and answered a number of time in this forum. Please SearchFirst.

If I find the previous discussion, I'll post it here. But you can probably save some time by poking around.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Essentially, the life-cycle init() method gives you access to the ServletConfig instance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic