阿摩線上測驗 登入

試題詳解

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

試卷資訊

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

科目:OCE

56 Assume a JavaBean com.example.GradedTestBean exists and has two attributes. The attribute name of type java.lang.string and the attribute score is of type jave.lang.Integer. An array of com.example.GradedTestBean objects is exposed to the page in a request-scoped attribute called results. Additionally, an empty java.util.HashMap called resultMap is placed in the page scope. A JSP page needs to add the first entry in results to resultMap, storing the name attribute of the bean as the key and the score attribute of the bean as the value. Which code snippet of JSTL code satisfies this requirement?
(A) ${resultMap[results[0].name] = results[0].score}
(B) <c:set var="${resultMap}" key="{results[0].name}"value="${results[0].score}" />
(C) <c:set var="resultMap" property="${results[0].name}">${results[0].value}</c:set>
(D) <c:set var="resultMap" property="${results[0].name}">value="${results[0].score}" /> IT Certification Guaranteed, The Easy Way! 22
(E) <c:set target="${resultMap}" property="${results[0].name}">value="${results[0].score}" />
正確答案:登入後查看