• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about page scope

 
jeffrey z. lee
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which statements are true about scope in jsp pages?
1) Objects with page scope are stored in the implicit object PageConttext
2) If a page forwards to another page, objects created with request scope in the source page will be visible in request of the forwarded page
3) Objects with application scope can be created in pages that are not session-aware(with page attribute session=”false”
4) The implicit page object has pageContext scope
 
Raj Paul
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1,3 & 4 are correct
 
no more user
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think that 2 also is correct..
the attributes added in request have to be accesible in forwarded page,
dispatcher.forward(REQUEST,response)
please, clear up this..
thanks
 
Kyle Tang
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2 should be correct. remember, you can use RequestDispatcher to forward to an error-page? to do this, you set the exception related attributes in the request.
It is the parameters in the request, that may got lost. I might be wrong with this, it has been a while I kind of forget this point.
 
Raj Paul
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2) If a page forwards to another page, objects created with request scope in the source page will be visible in request of the forwarded page

Here it has been said... that objects created with request scope, does it mean objects that are set in request scope ?
if i create String s="" inside jspService(), it is request scope right ?
This variable u may not get in forwared page.

Raj Paul
 
no more user
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Raj Paul:
if i create String s="" inside jspService(), it is request scope right ?

default scope is page.
 
no more user
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

4 is really correct !?

i believe pageContext is not a valid scope
[ December 10, 2006: Message edited by: Alexandre Lima ]
 
Nazmul Huda Sarkar
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Raj Paul:
2) Here it has been said... that objects created with request scope, does it mean objects that are set in request scope ?
Raj Paul

Isn't it ??? If some one says that a object created with some scope, then what should we understand ??? ...ofcourse the object has to be set in that scope. If the object is not set in that scope then what the meaning of saying that it is created with that scope...
[ September 29, 2002: Message edited by: Nazmul Huda Sarkar ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic