Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

page scope

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I understand the concept of request scope, session scope & application scope.
However I am not clear about the page scope(and page context also..). Can somebody please explain with an example?
Thank you...........
 
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amru-

My understanding is that page scope is the immediate page in which an attribute is set. If the user is forwarded to another page the attribute will not be passed along with the request, with the session or available via the application. It's just for the life of a single page.

In another post, Shawn Bayern described a use case. If you have a variable in the context of a scriptlet and you want it to be accessible within a JSP tag, then you can set the variable as an attribute in the pageContext and the JSP tag will be able to access it from there.
https://coderanch.com/t/280935/JSP/java/JSTL-pageScope

Josh
 
Ranch Hand
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Objects set in page scope are accessible in a translation unit in which they are defined. i.e they exist in a single translation unit and only for processing of a single request.These objects are maintained as attribute value pairs by an instance of a concrete subclass of the abstract class PageContext.(in jsp this instance is available as implicit object pageContext).
The only way for actions(Standard JSP actions and custom tags) to share data and JavaBean objects with other actions appearing in the same JSP page (translation unit) and in same request is to use the pageContext and page Scope.

 
Amru Jahagirdar
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Josh & Bindu, thanks for the reply.. It helped me.
 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic