Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Page vs request

 
priya Agrawal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

can any one tell me what is differnce between page and request. and where to use this PageScope and where to use ApplicationScope?

thanks,
Priya Agrawal
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know what a request is?

If not, I recommend reading up on that first. Most books that explain JSPs/Servlets begin with a couple chapters on how requests/responses work and how to use them in J2EE.

If you already understand requests, well, you probably wouldn't need to ask this question.
[ July 28, 2006: Message edited by: Marc Peabody ]
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, as Marc said first you need to understand what request is.

If you know already what request is.. Request can go over multiple servlets and pages(by forwarding one to another). Request scope attribute has the lifetime as long as that request is available. Page scope attribute is available only in that particular page and not available through out the request.
You can think page attribute as still smaller scope than request.

There is no rule which says in which scope we need to have attribute value. It all depends on your application logic. You may probably store common attributes to entire applicaiton such as application name or admin email etc., in applicaiton scope. user name and user locale etc., in session scope. user entered values specific to screen in request scope.
HTH
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic