Which statement about jspInit() are true?

  1. It has access to a ServletConfig

  2. It has access to a ServletContext

  3. It is only called once

  4. It can be overridden


Correct Option: A,B,C,D

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) It has access to a ServletConfig - This option is correct. The jspInit() method in JSP has access to a ServletConfig object, which provides information about the JSP's configuration settings.

Option B) It has access to a ServletContext - This option is correct. The jspInit() method in JSP also has access to a ServletContext object, which provides information about the JSP's execution environment.

Option C) It is only called once - This option is correct. The jspInit() method is called only once during the lifecycle of a JSP. It is called when the JSP is initialized or loaded for the first time.

Option D) It can be overridden - This option is correct. The jspInit() method can be overridden in a JSP's Java code. By overriding the jspInit() method, you can provide custom initialization logic for the JSP.

Based on the explanations above, all of the given options (A, B, C, and D) are true. Therefore, the correct answer is A, B, C, D.

Find more quizzes: