Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the difference between page and request scope

 
Rinku Sharma
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
What is the difference between Page and Request scope and when should each of these be used in a JSP page.How does request scope work between JSP pages.
Bye,
Amit
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rinku Sharma:
What is the difference between Page and Request scope

There is a difference only if you use <jsp:forward> (or <jsp:include> ). Page scoped beans do not survive the forward, request scoped beans do. Forwarding basically means that the request is passed on to a different JSP or servlet and it is up to that servlet to generate the response. Because the new JSP is still handling the same request, it has access to all request-scoped beans.
- Peter

[This message has been edited by Peter den Haan (edited June 07, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic