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 ServletConfig and ServletContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletConfig and ServletContext" Watch "ServletConfig and ServletContext" New topic
Author

ServletConfig and ServletContext

Sachin Ramesh Vir
Greenhorn

Joined: Sep 15, 2005
Posts: 23
Hi,

I want to know the difference between ServletConfig and ServletContext. Where these two will be used? Example with one real time for each will be useful?
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
ServletConfig is for one particular servlet, ServletContext is for whole web application within one JVM. Both can be used for configuration, context also for storing attributes that need to be accessible for the whole application.


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Sachin Ramesh Vir
Greenhorn

Joined: Sep 15, 2005
Posts: 23
thanks for your reply,

Can I know what is an attribute? Whether it is differ from the parameters?(though very silly questions, which I can able to understand the concept very well)
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Basic difference:
Parameter - String
Attribute - Object
alberto gonzalez
Greenhorn

Joined: Sep 05, 2005
Posts: 14
- Parameters are set at browser level. Values in a form etc
- Attributes are set at server level. You can set them at Request, Session, Context(application) level
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ServletConfig and ServletContext
 
Similar Threads
passing ServletContext
Why Init() method
Diff between ServletContext and servletConfig
Where does ServletContect come in the hierarchy ?
context/config