阿摩線上測驗 登入

試題詳解

試卷:無年度 - Java EE 6 Web Component Developer Certified Expert Exam:1z0-899(1-50)#84202 | 科目:OCE

試卷資訊

試卷名稱:無年度 - Java EE 6 Web Component Developer Certified Expert Exam:1z0-899(1-50)#84202

科目:OCE

42 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?
(A) You cannot do this because context parameters CANNOT be altered programmatically.
(B) String ext = context.getParameter('licenseExtension');if ( ext == null ) { context.setParameter('licenseExtension' DEFAULT);}
(C) String ext = context.getAttribute('licenseExtension');if ( ext == null ) { context.setAttribute('licenseExtension' DEFAULT);}
(D) String ext = context.getInitParameter('licenseExtension')if ( ext == null ) { context.resetInitParameter('licenseExtension' DEFAULT);}
(E) String ext = context.getInitParameter('licenseExtension')if ( ext == null ) { context.setInitParameter('licenseExtension' DEFAULT);}
正確答案:登入後查看