What are the different scopes in JSP?

Answered

What are the different scopes in JSP?

Ninja Asked on 18th September 2018 in Jsp.
Add Comment
1 Answer(s)
Best answer

Objects in a JSP, whether explicit or implicit, are accessible within a particular scope. In the case of explicit objects, such as a JavaBean instance created in a <jsp:useBean> action statement, you can explicitly set the scope using the attribute scope=”scopevalue”.

There are four scopes available in JSP:

  1. page” scope – The object is accessible only from within the JSP page where it was created.
  2. request” scope  – The object is accessible from any JSP page servicing the same HTTP request that is serviced by the JSP page that created the object.
  3. session” scope – The object is accessible from any JSP page sharing the same HTTP session as the JSP page that created the object.
  4. application” scope – The object is accessible from any JSP page used in the same Web application (within any single Java virtual machine) as the JSP page that created the object.
Ninja Answered on 18th September 2018.
Add Comment