nerdexam
Oracle

1Z0-899 · Question #194

You have built a web application that you license to small businesses. The webapp uses a context parameter, called licenseExtension, which enables certain advanced features based on your client's…

The correct answer is E. String ext = context.getInitParameter(`licenseExtension')if ( ext == null ). See the full explanation below for the reasoning.

Question

You have built a web application that you license to small businesses. The webapp uses a context parameter, called licenseExtension, which enables certain advanced features based on your client's license package. When a client pays for a specific service, you provide them with a license extension key that they insert into the <context-param> of the deployment descriptor. Not every client will have this context parameter so you need to create a context listener to set up a default value in the licenseExtension parameter. Which code snippet will accomplish this goal?

Options

  • AYou cannot do this because context parameters CANNOT be altered programmatically.
  • BString ext = context.getParameter(`licenseExtension');if ( ext == null )
  • CString ext = context.getAttribute(`licenseExtension');if ( ext == null )
  • DString ext = context.getInitParameter(`licenseExtension')if ( ext == null )
  • EString ext = context.getInitParameter(`licenseExtension')if ( ext == null )

How the community answered

(31 responses)
  • A
    3% (1)
  • B
    6% (2)
  • C
    10% (3)
  • E
    81% (25)

Community Discussion

No community discussion yet for this question.

Full 1Z0-899 Practice