Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When does the ServletConfig object gets created?

 
geet kaur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it in between the constructor and init() call??I am confused
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
geet kaur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok...thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic