• Post Reply Bookmark Topic Watch Topic
  • New Topic

page Vs pageContext  RSS feed

 
NandaM Kishore
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
 
Shraddha Jain
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66152
146
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
 
Magesh Kumar
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!