File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes page scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "page scope" Watch "page scope" New topic
Author

page scope

Amru Jahagirdar
Ranch Hand

Joined: Sep 16, 2009
Posts: 39
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...........
Joshua Smith
Ranch Hand

Joined: Aug 22, 2005
Posts: 193
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.
http://www.coderanch.com/t/280935/JSP/java/JSTL-pageScope

Josh


Rational Pi Blog - Java, SCJP, Dev Bits- http://rationalpi.wordpress.com
Bindu Lakhanpal
Ranch Hand

Joined: Oct 17, 2008
Posts: 163


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

Joined: Sep 16, 2009
Posts: 39
Josh & Bindu, thanks for the reply.. It helped me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: page scope
 
Similar Threads
Scwcd doubt
Confusion about "scope" attribute
Question on c:set
web components certification question
Difference between request Scope and Page Scope?