aspose 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply 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
Rancher

Joined: Apr 07, 2010
Posts: 1041

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Life-cycle of PageContext object
 
Similar Threads
pagecontext object
Hints for SCWCD
difference in forwarding using PageContext.forward and RequestDispatcher.forward
Getting ServletContext
the difference...