• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

scope resolution in JSP

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone explain the difference between 'page scope' and 'request scope'? In this book I am reading it says, " The request scope is for objects that need to be available to all pages processing the same request".
I am confused by this statement. Lets say I have page A that has a 'Next' button that takes me to page B. Similarly the 'Next' on page B takes me to page C and so on.. Now, isn't the request made to the web server different from Next on page A to that of the Next on page B?! If that is true, how can we have the "same request" for multiple pages?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page scope is the smallest, an object in page scope can't be seen if you forward the request. It has nothing to do with your example of HTML pages, it refers to a JSP page.
An object in request scope only lives during a single request - response cycle.
Bill
------------------
author of:
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you set a page-scope attribute and then forward the request, the attribute will not be visible to the forwarded page. If you set a request-scope attribute, it will be visible to the forwarded page. I believe pages included via jsp:include work the same way, but I'm not 100% sure.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That helps!! Thanks a lot :-)
 
Lookout! Runaway whale! Hide behind this tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic