aspose file tools*
The moose likes Servlets and the fly likes Servlet init() vs constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet init() vs constructor" Watch "Servlet init() vs constructor" New topic
Author

Servlet init() vs constructor

rinku jain
Greenhorn

Joined: Jan 04, 2011
Posts: 26
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

Joined: Jan 10, 2002
Posts: 61652
    
  67

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61652
    
  67

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

Joined: Jan 10, 2002
Posts: 61652
    
  67

Essentially, the life-cycle init() method gives you access to the ServletConfig instance.
 
 
subject: Servlet init() vs constructor