Which of the following statements is true regarding the scope of ‘page’ in JSP.

  1. Objects with page scope are accessible only within the page where they are created

  2. • References to objects with page scope are stored in the pagecontext object

  3. All references to such an object shall be released after the response is sent back to the client from the JSP page or the request is forwarded somewhere else.

  4. All of the above.


Correct Option: D

AI Explanation

To answer this question, we need to understand the scope of 'page' in JSP.

Option A) Objects with page scope are accessible only within the page where they are created - This option is correct. Objects with page scope in JSP are accessible only within the page where they are created. They cannot be accessed from other JSP pages or servlets.

Option B) References to objects with page scope are stored in the pagecontext object - This option is correct. References to objects with page scope are stored in the pagecontext object. The pagecontext object provides access to various scoped objects, including page scope.

Option C) All references to such an object shall be released after the response is sent back to the client from the JSP page or the request is forwarded somewhere else - This option is correct. All references to objects with page scope should be released after the response is sent back to the client or the request is forwarded to another page. This is to prevent memory leaks and ensure efficient memory usage.

Therefore, the correct answer is D) All of the above. All the statements provided in options A, B, and C are true regarding the scope of 'page' in JSP.

Find more quizzes: