This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Confusion between page scoped objects and Request scoped objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Confusion between page scoped objects and Request scoped objects" Watch "Confusion between page scoped objects and Request scoped objects" New topic
Author

Confusion between page scoped objects and Request scoped objects

Shwetha Sharma
Ranch Hand

Joined: Jun 01, 2008
Posts: 34

According to Jsp speculations,
All references to page scoped objects shall be released after the response is sent back to the client from the JSP page.
References to the request scoped objects shall be released after the request is processed.
Aren't all page scoped objects withing the request scope.
I am not able to make out the exact difference between them.

SCJP6:80%, OCWCD 88 %
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Shwetha Sharma wrote:
All references to page scoped objects shall be released after the response is sent back to the client from the JSP page.

Give me the fragment from the specs about that.

Page Scope and Request Scope are not the same. One request can be handled by many servlets and JSP using forward(...) method. All of the servlets and JSP will be able to use that request variables but Page Variables can be reached from within the page which declared them.
Page Scope is the narrowest one.


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Shwetha Sharma
Ranch Hand

Joined: Jun 01, 2008
Posts: 34


Give me the fragment from the specs about that.


This is the fragment from the speculations

Objects are created within a JSP page instance that is responding to a request
object. There are several scopes:
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.
request - Objects with request scope are accessible from pages processing the
same request where they were created. References to the object shall be released
after the request is processed. In particular, if the request is forwarded
to a resource in the same runtime, the object is still reachable. References to
objects with request scope are stored in the request object.
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

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

Please read my first post in this thread once again carefully
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Shwetha Sharma wrote:According to Jsp speculations

These are called specifications


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusion between page scoped objects and Request scoped objects
 
Similar Threads
what is use of page object?
Tag question
A Speculation
scopes
Binding user objects to request,session,pagecontext, application