|
|
|
| javaprepare.com
your tool for Java Certification |
SCWCD home | SCWCD questions | SCWCD links | SCJP home
javaprepare.com - 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
servlet element in the deployment descriptor is used to specify the parameters for the ServletConfig object. Select the one correct answer.
- servlet-config
- init-param
- load-on-startup
- filter
-
Which of these is true about deployment descriptors. Select the one correct answer.
- The order of elements in deployment descriptor is not important. The elements can follow any 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. Select the one correct answer.
- error-page
- servlet
- exception
- error-handling
-
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 element of the deployment descriptor of a web application includes the welcome-file-list element as a subelement. Select the one correct answer.
- web-app
- welcome-file
- servlet
- file-list
- 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 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>
- The root of the deployment descriptor is named as
- web
- web-app
- name
- display-name
- With in a context-param element of deployment descriptor, which of the following element is required?
- param-name
- name
- init-param
- servlet-name
- Which of these is not a valid top level element in web-app
- icon
- listener
- eror-page
- security-constraint
- param-name
- Which of the follwing are mandatory elements within the filter element. Select two correct answers.
- filter-name
- name
- value
- filter-class
- init-param
- Which of these is not a valid value for dispatcher element of filter-mapping. Select the one correct answer.
- FORWARD
- RESPONSE
- INCLUDE
- ERROR
- Which of these is not correct about the filter-mapping element of web-app. Select the one correct answer.
- filter-name element must be present in the filter-mapping element.
- Either url-pattern or servlet-name must be present in the filter-mapping element.
- dispatcher element can be declared zero to three times in the filter-mapping element.
- filter-name element in the filter-mapping should be same as the corresponding filter-name element in the filter element of deployment descriptor.
Answers to questions on Deployment Descriptor
- C. The deployment descriptor must be called web.xml and be placed in the directory named WEB-INF
- B. init-param is used to specify parameters that are accessed using ServletConfig object.
- A. In the deployment descriptor the elements in the web-app element can come in any order. B is incorrect because elements are case-sensitive.
The servlet-mapping element should be included within the <web-app> element. So C is incorrect. All the elements within the web-app element are optional. So D is incorrect.
- a. error-page element in the element web-app element is used to specify the exception name.
- b. The error-page element includes exception-type and location as sub-element. Both these elements must be defined.
- A. welcome-file-list is included within the web-app element.
- A,D. error-page element must include either exception-type or error-code element but not both. It must also include the location element.
- B. The element listener-class must be included within the listener element.
- B. <web-app> element is the root of the deployment descriptor. It has one attribute named version.
- A. param-name and param-value are required within the context-param element.
- E. param-name is a child of context-param element.
- A and D. filter-name and filter-class are required elements of the filter element.
- B. The four possible values of the dispatcher element are - FORWARD, INCLUDE, REQUEST and ERROR. RESPONSE is not a value for the dispatcher element.
- C. dispatcher element can be declared upto four times.
SCWCD home | SCWCD questions | SCWCD links | SCJP home
|