• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what is use of page object?

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On page 311 on HFS&J:

pageContext getAttribute(String) is for page scope.

Then what is the use of page implicit object???

Thanks.
[ December 07, 2005: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
page is an object of type JspPage, or you can say javax.servlet.Servlet. Since Servlet is a parent of JspPage. Please refer to JSP.12.1.1 of JSP 2.0 Spec. I believe page object works like this.


Whereas, pageContext extends JspContext and is to provide useful context information. As you know it is there in JSP.12.2.2 of JSP 2.0 Spec.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adeel Ansari:


Whereas, pageContext extends JspContext and is to provide useful context information. As you know it is there in JSP.12.2.2 of JSP 2.0 Spec.



I suppose, application object is for context (application) information, not the pageContext object.
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From Spec: Page:75

About page implicit object.


page - Objects with page scope are accessible only within the page where they
are created. All references to such an object shall be released after the response is sent back to the client from the JSP page or the request is forwarded somewhere else. References to objects with page scope are stored in the pageContext object


[ December 07, 2005: Message edited by: Vishnu Prakash ]
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The page implicit object (not to be confused with pageContext) is a reference to the implementation object for the JSP. Essentially it is the this reference for the JSP's implementation class.

i can think of no reason that you would need to access this object. Of course at this point, I see no reason to have scripting on the JSP pages at all, but that's deeper issue.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
The page implicit object (not to be confused with pageContext) is a reference to the implementation object for the JSP. Essentially it is the this reference for the JSP's implementation class.

i can think of no reason that you would need to access this object. Of course at this point, I see no reason to have scripting on the JSP pages at all, but that's deeper issue.



Page is this then why we set page scope attribute in pageContext???

Thanks.
 
Bear Bibeault
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because page (or this) is not a scoped context. pageContext is.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
Because page (or this) is not a scoped context. pageContext is.



Sorry Bear, I didn't get this.
 
Bear Bibeault
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The object referenced by page is simply not designed to serve as a scoped context. Your question is a lot like asking why you can't use the brake pedal to steer a car. It's not what it was designed for.

If you want to store a scoped variable in page context, you store it in the pageContext object. That's pretty straight-forward and simple.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic