This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes Page scope and request scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Page scope and request scope" Watch "Page scope and request scope" New topic
Author

Page scope and request scope

satish pune
Ranch Hand

Joined: Sep 04, 2003
Posts: 44
Hello ,
Could someone explain the difference between the two scopes : page and request
Is there any specific place where we should use page scope ?
What are the advantages / disadvantages of page scope ?
Thanks in advance ,
-satish
Owee Nicolas
Ranch Hand

Joined: Jun 16, 2002
Posts: 49
Hi Satish,
If you are using the two scopes with regards to instantiating a JavaBean within a JSP using the jsp:UseBean tag, the page scope means that the JavaBean is available from the current page. This is the default.
The request scope means the JavaBean is available from the current page's request object using the getAttribute method. This reference is discarded upon completion of the current client request.
The advantage of using the page scope is that the JavaBean is only instantiated on that particular page. This is useful for short operations and those that does not require object persistance.
Hope this helps.


Owee<br />SCJP 1.4
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Page scope and request scope
 
jQuery in Action, 3rd edition