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

Life-cycle of PageContext object

Kevin Kilbane
Ranch Hand

Joined: Sep 22, 2008
Posts: 42
Hi. I'm slightly confused by the pageContext implicit variable in a JSP.

What relationship does the PageContext object have with a JSP, a request etc.? Is there one PageContext object per JSP or one per execution of the JSP or something else?

There doesn't seem to be a PageContext object available in a servlet - is that right?

I've had a look at the API and a search in google but I'm still not 100% clear.

Thanks in advance.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1733
    
  25

Hi Kevin,

According to the jsp2.0 spec:
JSP.1.8.4 The pageContext Object
A PageContext is an object that provides a context to store references to objects
used by the page, encapsulates implementation-dependent features, and provides
convenience methods.

So you have one PageContext per JSP, per execution of the JSP.

There doesn't seem to be a PageContext object available in a servlet - is that right?

Yes, that is to seperate ModelViewControl (MVC).

Regards,
Frits
Kevin Kilbane
Ranch Hand

Joined: Sep 22, 2008
Posts: 42
OK, thanks for the reply Frits
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Life-cycle of PageContext object