Which invocation on the pageContext object, inserted at line 6(//insert code here), assigns “bar” to the variable x?

Given the JSP code :
<%request.setAttribute("foo","bar");%>
And the classic tag handler code :
Public int doStartTag() throws JspException{
//insert code here
//return int
}
Assume there are no other “foo” attributes in the web application. Which invocation on the pageContext object, inserted at line 6(//insert code here), assigns “bar” to the variable x?
A. String x = (String) pageContext.getAttribute(“foo”);
B. String x = (String) pageContext.getRequestScope(“foo”);
C. It is NOT possible to access the pageContext object from within doStartTag.
D. String x = (String) pageContext.getRequest().getAttribute(“foo”);
E. String x = (String) pageContext.getAttribute(“foo”, PageContext.ANY_SCOPE);

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.