|
|
|
SCWD home | SCWD questions | SCWD links | SCJP home
studyjava.org - Questions on Deployment Descriptor
-
Which of the following files is the correct name and location of deployment descriptor of a web application. Assume that the web application is rooted at \doc-root.
Select the one correct answer
- \doc-root\dd.xml
- \doc-root\web.xml
- \doc-root\WEB-INF\web.xml
- \doc-root\WEB_INF\dd.xml
- \doc-root\WEB-INF\dd.xml
- \doc-root\WEB_INF\web.xml
- \doc-root\WEB-INF\lib\dd.xml
- \doc-root\WEB-INF\classes\dd.xml
-
Which element of the deployment descriptor is used to specify the class of the servlet. Do not include the element in enclosing parenthesis. So the answer should be element instead of .
-
Which of these is true about deployment descriptors. Select the one correct answer.
- The order of elements in deployment descriptor is important. The elements must follow a specific order.
- The elements of deployment descriptor are case insensitive.
- The servlet-mapping element, if defined, must be included within the servlet element.
- The web-app element must include the servlet element.
-
The exception-type element specifies an exception type and is used to handle exceptions generated from a servlet. Which element of the deployment descriptor includes the exception-type as a sub-element. Do not include the element in enclosing parenthesis.
-
Which of these is a correct fragment within the web-app element of deployment descriptor. Select the one correct answer.
- <exception>
<exception-type> mypackage.MyException</exception-type>
<location> /error.jsp</location>
</exception>
-
<error-page>
<exception-type> mypackage.MyException</exception-type>
<location> /error.jsp</location>
</error-page>
- <error-page>
<exception> mypackage.MyException </exception-type>
<location> /error.jsp </location>
</error-page>
- <error-page>
<exception-type> mypackage.MyException</exception-type>
</error-page>
- <error-page>
<servlet-name> myservlet</servlet-name>
<exception-type> mypackage.MyException</exception-type>
</error-page>
- <exception>
<servlet-name> myservlet</servlet-name>
<exception-type> mypackage.MyException</exception-type>
</exception>
- Which of these is a correct fragment within the web-app element of deployment descriptor. Select the two correct answer.
-
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
-
<error-page>
<exception-type>mypackage.MyException</exception-type>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
-
<error-page>
<exception-type>mypackage.MyException</exception-type>
<error-code>404</error-code>
</error-page>
-
<error-page>
<exception-type>mypackage.MyException</exception-type>
<location>/error.jsp</location>
</error-page>
-
Which element of the deployment descriptor of a web application includes the welcome-file-list element as a subelement.
- Which of these is a correct example of specifying a listener element resented by MyClass class. Assume myServlet element is defined correctly. Select the one correct answer.
-
<listener>MyClass</listener>
- <listener> <listener-class>MyClass</listener-class></listener>
- <listener>
<listener-name>aListener</listener-name>
<listener-class>MyClass</listener-class>
</listener>
- <><listener>
<servlet-name>myServlet</servlet-name>
<listener-class>MyClass</listener-class>
</listener>
Answers to questions on Deployment Descriptor
- c. The deployment descriptor must be called web.xml and be placed in the directory named WEB-INF
- servlet-class . The element servlet-class specifies the class of servlet. For example - abc.def.XYZ
- a. The servlet specifications specifies a specific order of deployment descriptor. b is incorrect because elements are case-sensitive.
The servlet-mapping element should be included within the element. So c is incorrect. All the elements within the web-app element are optional. So d is incorrect.
- error-page . The element error-page includes the element web-app.
- b. The error-page element includes exception-type and location as sub-element. Both these elements must be defined.
- a,d. error-age element must include either exception-type or error-code element but not both. It must also include the location element.
- web-app
- b. The element listener-class must be included within the listener element.
SCWD home | SCWD questions | SCWD links | SCJP home
|