• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ServletConfig vs ServletContext

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,

What is the differance between ServletConfig and Servlet Context?
Which is same for all servlets(for the application.

Thanks in Advance.

Regards
Smitha Amresh Parika
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question has been asked a few times here. Use the search tool with ServletConfig and ServletContext as keywords and you should be able to find
those conversations.

In the mean time, the best source of information for a question like this is the API documentation:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletConfig.html
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Smitha Amresh:
Which is same for all servlets(for the application.



ServletContext
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlet Config as the name suggests, provides Servlet specific configuration information to a particular servlet. For Example :- the information that u specify in the web.xml file like this

<servlet>
<init-param>...

</init-param>
</servlet>

Each servlet will have its own servlet config object, which will be specific to that servlet.

ServletContext
--------------
It provides application view to all the servlets. There is one ServletContext per JVM for one application.
It also provides methods to access application wide parameters specified
in <context-param>....</context-param> tag in web.xml.

These will be accessible to all the servlets.

I hope it works for you...
 
reply
    Bookmark Topic Watch Topic
  • New Topic