Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is 'Page scope' in jsp?

Tags:

java

jsp

servlets

There are following scopes in JSP:

  • page scope
  • request scope
  • session scope
  • application scope

I am confused about page scope. Can anybody tell me what is this page scope? I have not found its clear definition anywhere.

like image 748
a Learner Avatar asked Mar 31 '14 15:03

a Learner


People also ask

What is scope in JSP?

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.

How many types of scopes are available in JSP?

Type of Scopes in JSP: JSP provides 4 scopes to a variable. Developer can assign any one of them to a variable.

Which is the biggest scope provided by JSP?

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.

What is the default scope of JSP bean?

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.


1 Answers

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.

like image 73
Prabhaker A Avatar answered Sep 22 '22 02:09

Prabhaker A