nerdexam
Oracle

1Z0-899 · Question #186

Given the java code snippet in contextInitialized method of a ServletContextListner: ServletRegistration.Dynamic sr = (ServletRegistration.Dynamic)sc.addServlet ("myServlet", myServletClass)…

The correct answer is D. Both "/abc" and "/def" are mapped to "myservlet". See the full explanation below for the reasoning.

Question

Given the java code snippet in contextInitialized method of a ServletContextListner: ServletRegistration.Dynamic sr = (ServletRegistration.Dynamic)sc.addServlet ("myServlet", myServletClass); sr.addMapping("/abc"); sr.setServletSecurityElement(servletSecurityElement); sr.addMapping("/def"); Which statement is true?

Options

  • A"/abc" is mapped to "myservlet".
  • BBoth "/abc" and "/def" are mapped to "myservlet".
  • CBoth "/abc" and "/def" are mapped to "myservlet".
  • DBoth "/abc" and "/def" are mapped to "myservlet".
  • EBoth "/abc" and "/def" are mapped to "myservlet".

How the community answered

(26 responses)
  • A
    4% (1)
  • B
    12% (3)
  • D
    81% (21)
  • E
    4% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-899 Practice