aspose file tools
The moose likes Servlets and the fly likes Servlet init() vs constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply 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: 56529
    
  14

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.

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56529
    
  14

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: 56529
    
  14

Essentially, the life-cycle init() method gives you access to the ServletConfig instance.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Servlet init() vs constructor
 
Similar Threads
can init() be replaced in servlet?
Why is init() needed?
init and constructor in servlet
Init() Vs Constructor
java and servelt