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

ServletConfig : is it created one for each servlet?

 
Sekhar Kadiyala
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletConfig object is created one for each servlet or one for each instance. When i mean instance, i guess, we can create multiple instances for the same servlet.

Thanks in advance!
 
Bin Gao
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the servlet container should create one servletConfig for each servlet instance. We can see the protype of function init:
public init(ServletConfig servletConfig);

When one servlet is created, the init(ServletConfig) will be called once.
 
Kaspar Minosiantz
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO ServletConfig object is created one for each servlet .
For instance when we create


OurServlet inherits an implementation of ServletConfig form GenericServlet
[ August 19, 2004: Message edited by: Kaspar Minosiantz ]
 
Ian Perkins
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The servlet container will only create one instance of each servlet; that is why writing thread-safe code is so important...

Therefore, by definition, there can only be one ServletConfig for each servlet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic