Attributes in "page scope" are the shortest and the most local. It is bound to the pageContext object for the current request. If an object is set as an attribute with in page scope then this object will not be available if the request is forwarded to another web component. Page Attributes are accessible/available only within the specific JSP page and is destroyed when the page has finished generating its output for the request.
Page scope is usually used with custom tags, and it is a way to pass data from the jsp page to the custom tag.
Attributes in “request scope” are accessible/available to any jsp page or servlet that are part of the specific request chain. For instance, if I made a GET request to servlet1, which gets forwarded to servlet2, which gets forwarded to jsp3, etc... attributes put in request scope in servlet1 would be available in jsp3 as well.
Attributes in "session scope" allows objects to be stored and retrieved across multiple requests for this user's session. Session Attributes are accessible/available to any jsp page or servlet that are part of the user’s session.
Attributes in "application scope" or context scope are accessible/available to all requests for the current application.
0 Comments:
Post a Comment
<< Home