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 Difference Betn. ServletContext and ServletConfig!! 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 "Difference Betn. ServletContext and ServletConfig!!" Watch "Difference Betn. ServletContext and ServletConfig!!" New topic
Author

Difference Betn. ServletContext and ServletConfig!!

Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
Hello Folks,
I would like to know the difference between the Servlet Context and Servlet Config.
Regards,
Ravi
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
ServletContext is the over all web application. These include the the parameters you list in the web.xml in the context-param element. (outside any servlet elements you specify) There is a single copy for any and all servlets and jsps running in the web application. Additionally, any Attribute you add to the ServletContext is available to them all and there is one and only one.
ServletConfig is the configuration for a single Servlet or JSP. These include the init-param you list within the servlet element of the web.xml. ServletConfig doesn't have the ability to set or get Attributes.


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference Betn. ServletContext and ServletConfig!!
 
Similar Threads
generic servlet and http servlet
Servlets
servlet
Controller,Normal
Servlets