This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet Config and Servlet Context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Config and Servlet Context" Watch "Servlet Config and Servlet Context" New topic
Author

Servlet Config and Servlet Context

Shahir Deo
Ranch Hand

Joined: Mar 19, 2013
Posts: 78

If we have 10 Servlets then how many Servlet Config and Servlet Context should i have? Asked in Interview to my frnd


Knowledge enlivens the soul.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41015
    
  43
What was his answer? What do you think the answer is?


Ping & DNS - my free Android networking tools app
Shahir Deo
Ranch Hand

Joined: Mar 19, 2013
Posts: 78

Ulf Dittmer wrote:What was his answer? What do you think the answer is?


He said " 1 Servlet Context and 10 Servlet Config."

Is this rite?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

You mean "right". What do you think? Why do you think he was right or wrong?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shahir Deo
Ranch Hand

Joined: Mar 19, 2013
Posts: 78

Bear Bibeault wrote:You mean "right". What do you think? Why do you think he was right or wrong?

Just want to ensure , if it is wrong so we can rectify it !
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

You still haven't answered the question. Do you think he was right? If you don't know, then this is good opportunity to look into the Servlet Spec and find out for sure.
Shahir Deo
Ranch Hand

Joined: Mar 19, 2013
Posts: 78

Bear Bibeault wrote:You still haven't answered the question. Do you think he was right? If you don't know, then this is good opportunity to look into the Servlet Spec and find out for sure.


Yes , It is Right , because One ServletConfig per servlet and One ServletContext per JVM ..

So ?
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

Shahir Deo wrote:

Yes , It is Right , because One ServletConfig per servlet and One ServletContext per JVM ..

So ?


"There is one context per "web application" per Java Virtual Machine."
"and one config per servlet"

cheers for you looked into the servlet specs.


http://plainoldjavaobject.blogspot.in
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Servlet Config and Servlet Context
 
Similar Threads
servlet context vs servlet config
init parameter.
Servlets
Why sometimes servlets have got .do extension (why this)
Servlet context and config