File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
 
subject: Difference Betn. ServletContext and ServletConfig!!
 
Similar Threads
servlet
Servlets
Servlets
Controller,Normal
generic servlet and http servlet