• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between page and request

 
Vasudevan Gopalan
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
In jsp:useBean we are giving scope.I understood session and application scope.I want to know the difference of page and request.How these two are different.

Thanks in advance.
Regards
Vasu
 
R K Singh
Ranch Hand
Posts: 5388
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scope
-------
page : bean will be available to only that JSP, say JSP01.jsp.
request : Bean will be available for that request. Request can be across multiple JSPs/servlets. Request scope is till the server returns the response. Once response is returned bean becomes out of scope.
session : bean will be available througout the session.
application : bean will be available throughout the application, to all JSPs/servlets.
HTH
 
Vasudevan Gopalan
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can u give an example for request scope
 
R K Singh
Ranch Hand
Posts: 5388
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vasudevan Gopalan:
can u give an example for request scope

If you are forwarding request from JSP01.jsp to JSP02.jsp and if you create a bean in JSP01.jsp then
Scope - page :
then that bean wont be available to JSP02.jsp.
Scope - request :
then that bean will be available to JSP02.jsp and subsequent JSPs till you return the request.
HTH
 
Vasantha Prabha
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey u please refer to this topic "Question in getProperty".
I think this will clear your doubt
Regards,
Sangeetha Prabindh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!