Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

diff betwn ServletContext and ServletConfig  RSS feed

 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends,
i have searched the servlets forum and did not got any results for my topic in the subject.so i am posting here. would any one of u plz give me difference between ServletConfig and ServletContext with relavant examples and also situations where we can use them both.
 
Manish Jaju
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Basic difference between them, servletContext is used for intercommunication between servlet to servlet/jsp and servletConfig is used to get initial parameters at the time of initialising servlet.
 
Raja Chandar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletContext from context-param
ServletConfig from servlet init-param

ServletConfig is specific to a servlet and has values as defined in the
web.xml file as initial configuration parameters.

Whereas ServletContext is the context/application container where servlet operates
and has all the global parameters and multiple servlets runs.
[ October 07, 2004: Message edited by: Raja Chandar ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!