• Post Reply Bookmark Topic Watch Topic
  • New Topic

Life-cycle of PageContext object

 
Kevin Kilbane
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 2785
175
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, thanks for the reply Frits
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!