This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Servlets and the fly likes When does the ServletConfig object gets created? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "When does the ServletConfig object gets created?" Watch "When does the ServletConfig object gets created?" New topic
Author

When does the ServletConfig object gets created?

geet kaur
Ranch Hand

Joined: Sep 03, 2008
Posts: 78
Is it in between the constructor and init() call??I am confused
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19693
    
  10

It gets created before the init(ServletConfig) method is called. That's all you need to know. Whether or not it is created before the constructor is called is a meaningless question, because the constructor would not have access to it anyway.
geet kaur
Ranch Hand

Joined: Sep 03, 2008
Posts: 78
Thats what i was confused about..

I am going through the head first book

and i have read the following:
*container reads the dd including the init-params
*then it creates a ServletConfig Object
*then container creates a name-value pair of strings
*It gives the references of the init params to the ServletConfig Object
*the next step comprises of creating a new instance of the servlet class
*servlet calls the init() method passing in the ServletConfig Reference.

so that means before instantiating we have a ServletConfig???
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63054
    
  69

According to the Spec, it's really up to the container. As long as it is created before the first call to init(), everything is fine. But again, there's no need to care.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
geet kaur
Ranch Hand

Joined: Sep 03, 2008
Posts: 78
ok...thanks
 
 
subject: When does the ServletConfig object gets created?
 
jQuery in Action, 3rd edition