Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

page Vs pageContext  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody please help me by telling me the differences between page and pageContext?
I have gone through Java Server Programming(wrox press),but I couldn't understand anything.
I would be pleased if you can tell me the difference with a simple example.

Thanks in advance
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as far as i know page by itself has no meaning in JSP, its used as
<%@page attribute1="value1",attribute2="value2"... %>
which says this is a page directive: value1 for attribute1 and value2 for attribute2 holds good only for this page!
pageContext on the other hand is an object of class PageContext and it acts as a container for variables defined in a page and the life of these variables is equal to teh life of the jsp page they are defined in.
hope this helps.
 
Author and ninkuma
Marshal
Posts: 66821
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
page is a reference to the servlet implementation of the JSP. It is not generally useful. pageContext is a reference to the PageContext instance for the current JSP page.
 
NandaM Kishore
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by NandaM Kishore:
Can anybody please help me by telling me the differences between page and pageContext?
I have gone through Java Server Programming(wrox press),but I couldn't understand anything.
I would be pleased if you can tell me the difference with a simple example.

Thanks in advance




With pageContext implicit object we can derive all other implicit objects

Like we can get out object from getOut method which is available.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!