File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes PageContext and servletContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "PageContext and servletContext" Watch "PageContext and servletContext" New topic
Author

PageContext and servletContext

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
I realize while developing tags that we use the PageContext to retrieve the ServletContext.
I also understand that is one servletcontext per "web application" per Java Virtual Machine,and that it is used by a servlet to communicate with its container.
But,what is the relevance and scope of PageContext?

But where exactly in the lifecycle of a session does the pageContext fit in - at what exact stage is it created,its utility and when is the current data inside it populated?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61606
    
  67

Moved to the JSP forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61606
    
  67

Page context is the "lowest" of the context scopes. Its lifetime is limited to a single JSP page.
Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
Thanks.THen apart from retrieving the servletcontext,what are the other typical interactions a page will have or need to have with its pagecontext?I do not find much documentation on its interactions with JSP?
geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
pageContext is normally used in Custom Tags.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
Take a look at the methods described in pageContext. API link
That is what it can do in a JSP page.

What I mainly use it for is to get/set attributes for the page.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PageContext and servletContext