欢迎来到计算机考试题库网 考试题库官网
全部科目 > Java认证考试 > SCWCD(310-083)

单项选择题

Given the JSP code:
<% request.setAttribute("foo", "bar"); %>and the Classic tag handler code:
5. public int doStartTag() throws JspException {
6. // insert code here
7. // return int
8. }
Assume there are no other "foo" attributes in the web application.
Which invocation on the pageContextobject,inserted at line 6,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)

点击查看答案

相关考题