Oracle
1Z0-899 · Question #170
Given a war file with the following structure | - WEB-INF/classes/Myservlet.class | - WEB-INF/lib/wf.jaf Where wf.jar contains a valid web-fragment.xml and the following two classes: MyFilter1.class…
The correct answer is C. MyFilter2. <filter-mapping> This tag specifies a filter name, and either a URL mapping or servlet name, for a filter that has been defined with the <filter> tag. Multiple <filter-mapping> tags can be specified for a single <filter>, providing different URL patterns. See the <url-pattern>…
Filters
Question
Given a war file with the following structure | - WEB-INF/classes/Myservlet.class | - WEB-INF/lib/wf.jaf Where wf.jar contains a valid web-fragment.xml and the following two classes: MyFilter1.class and MyFiler2.class. The web-fragment.xml is as follows: The following are some code snippets: When one access "/" of the above web application, which filters will be executed?
Exhibits
Options
- ANo filters will be executed.
- BMyFilter1
- CMyFilter2
- DMyFilter1 and MyFilter2
How the community answered
(21 responses)- A10% (2)
- B14% (3)
- C71% (15)
- D5% (1)
Explanation
- <filter-mapping> This tag specifies a filter name, and either a URL mapping or servlet name, for a filter that has been defined with the <filter> tag. Multiple <filter-mapping> tags can be specified for a single <filter>, providing different URL patterns. See the <url-pattern> tag for examples. The <filter-mapping> has two required elements: <filter-name> - the filter name, as specified in the <filter-name> element of the <filter> tag Either a <url-pattern> or a <servlet-name>. If a servlet name is specified, the filter will be called whenever the specific servlet is called.
Topics
#web-fragment.xml#filter mapping#JAR packaging#filter execution order
Community Discussion
No community discussion yet for this question.

