File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes ServletConfig vs ServletContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletConfig vs ServletContext" Watch "ServletConfig vs ServletContext" New topic

ServletConfig vs ServletContext

Smitha Amresh

Joined: Jun 13, 2005
Posts: 6
Hi folks,

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

Thanks in Advance.

Smitha Amresh Parika
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

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:

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Sharad Agarwal
Ranch Hand

Joined: Sep 11, 2002
Posts: 167
Originally posted by Smitha Amresh:
Which is same for all servlets(for the application.


Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
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



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

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...

I agree. Here's the link:
subject: ServletConfig vs ServletContext
jQuery in Action, 3rd edition