Which of the following directories are legal locations for the deployment descriptor file? Note that all paths are shown as from the root of the machine or drive.

  1. /WEB-INF

  2. /appserverInstallDirectory/webapps/webappName/WEB-INF/xml

  3. /appserverInstallDirectory/webapps/webappName/WEB-INF

  4. /appserverInstallDirectory/webapps/webappName/WEB-INF/classes


Correct Option: A,C

AI Explanation

To answer this question, we need to understand the purpose and location of the deployment descriptor file in web applications.

The deployment descriptor file, also known as web.xml, is an XML file that provides configuration information for the web application. It contains details such as the servlets, filters, and URL mappings.

Now let's go through each option to understand why it is correct or incorrect:

Option A) /WEB-INF - This option is correct because the deployment descriptor file is typically located in the WEB-INF directory of a web application. This directory is not accessible directly from the web browser, making it a suitable location for sensitive configuration files.

Option B) /appserverInstallDirectory/webapps/webappName/WEB-INF/xml - This option is incorrect because the deployment descriptor file is not typically located in a subdirectory named "xml" inside the WEB-INF directory. The deployment descriptor file is directly placed in the WEB-INF directory itself.

Option C) /appserverInstallDirectory/webapps/webappName/WEB-INF - This option is correct because it correctly identifies the location of the deployment descriptor file. The WEB-INF directory is a standard location for the deployment descriptor file in web applications.

Option D) /appserverInstallDirectory/webapps/webappName/WEB-INF/classes - This option is incorrect because the "classes" directory is not the correct location for the deployment descriptor file. The "classes" directory is typically used for storing compiled Java classes, not configuration files.

Therefore, the correct answer is Option A and Option C. These options correctly identify the legal locations for the deployment descriptor file.

Find more quizzes: