• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletConfig and ServletContext

 
Sachin Ramesh Vir
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sachin Ramesh Vir
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basic difference:
Parameter - String
Attribute - Object
 
alberto gonzalez
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic