There are following scopes in JSP:
I am confused about page scope. Can anybody tell me what is this page scope? I have not found its clear definition anywhere.
scope="session" : The object is accessible from any JSP page that is sharing the same HTTP session as the JSP page that created the object. A session-scope object is stored in the implicit session object.
Type of Scopes in JSP: JSP provides 4 scopes to a variable. Developer can assign any one of them to a variable.
Application scope is the broadest scope and should only be used when necessary. You can create objects bound at application level in JSPs that are not session-aware, so application scope is useful for storing information when using these types of JSPs.
The default scope is page. request: specifies that you can use this bean from any JSP page that processes the same request. It has wider scope than page.
page
scope means, it can be thought of as an object that represents the entire JSP page,i.e. the JSP object can be accessed only from within the same page where it was created.
The page object is really a direct synonym for the this
object.
Note:
The main difference between page scope and request scope(often confusing ) is that page scope attributes are no longer available if the request is forwarded to another JSP page where as request scope attributes are available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With