Identify which of the following are true statements about web applications

  1. The only way to access resources under the /WEB-INF directory is through appropriate servlet mapping directives in the deployment descriptor

  2. Server-side code has access to all resources in the web application

  3. Clients of web applications can't directly access resources in /WEB-INF/tld.

  4. A good place to keep a .tld (tag library file) is directly in the /WEB-INF directory.


Correct Option: 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) The statement says that the only way to access resources under the /WEB-INF directory is through appropriate servlet mapping directives in the deployment descriptor. This statement is incorrect. The /WEB-INF directory is not accessible to clients directly, but server-side code can access resources in this directory without the need for servlet mapping directives.

Option B) The statement says that server-side code has access to all resources in the web application. This statement is correct. Server-side code, such as servlets or JSPs, has access to all resources within the web application, including files in the /WEB-INF directory.

Option C) The statement says that clients of web applications can't directly access resources in /WEB-INF/tld. This statement is correct. The /WEB-INF directory and its subdirectories are not directly accessible to clients. Therefore, clients cannot directly access resources in /WEB-INF/tld.

Option D) The statement says that a good place to keep a .tld (tag library file) is directly in the /WEB-INF directory. This statement is correct. The /WEB-INF directory is commonly used to store configuration files, including tag library descriptor files (.tld).

To summarize:

Option A) Incorrect - The /WEB-INF directory can be accessed by server-side code without servlet mapping directives. Option B) Correct - Server-side code has access to all resources in the web application. Option C) Correct - Clients cannot directly access resources in /WEB-INF/tld. Option D) Correct - The /WEB-INF directory is a good place to keep a .tld file.

The correct answer is B, C, and D.

Find more quizzes: