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

ServletContext, ServletConfig and Pagecontext

aakash bhatt
Ranch Hand

Joined: Jan 09, 2003
Posts: 182
What is the differnce between ServletContext, ServletConfig and Pagecontext?

Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
When you read the documentation, which bits were you unsure about?
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5382
ServletContext : encapsulates all the information about the context in which all the Servlets are running.

ServletConfig : encapsulates the information about the configuration of the Servlet.

PageContext : encapsulates the information of context in which Page(jsp) is running in Servlet env.

Check this

"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Myra Rose
Ranch Hand

Joined: Jul 27, 2006
Posts: 44
Can anyone provide examples for all this?

Any help appreciated.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Any book or tutorial on Servlets will cover these issuse, early on.
It wouldn't make much sense to type it into here.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Sri Vishnu Mandaleeka

Joined: Jul 07, 2006
Posts: 2

Servlet Context: Its the oject through which we can see entire weapplication.

ServletConfig: Its the oject which is applicale to a paticular servlet.

PageContext: its the oject which is available to the paticular JSP page.
I hope this works for U. But for examples and detailed soluton gofor HFSJ.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

I hope this works for U

Sri Vishnu,

JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Please read this for more information.

JavaRanch Sheriff

[Asking smart questions] [About Bear] [Books by Bear]
Janakiram Gattupalli

Joined: Jul 30, 2006
Posts: 8
ServletContext can be thought as Gloabal parameters for a web-application.Using ServletContext we can get hold of Web application's details.There is only one servletContext for a web application.
ServletConfig is local to each Servlet.Using ServletConfig we can get the reference of ServletContext,name of the servlet,etc.
I agree. Here's the link:
subject: ServletContext, ServletConfig and Pagecontext
It's not a secret anymore!