nerdexam
Oracle

1Z0-899 · Question #176

A developer wants to make a name attribute available to all servlets associated with a particular user, across multiple requests from that user, from the same browser instance. Which two provide…

The correct answer is D. pageContext.getSession().setAttribute("name", theValue); F. pageContext.setAttribute("name", theValue, PageContext.SESSION_SCOPE). See the full explanation below for the reasoning.

Question

A developer wants to make a name attribute available to all servlets associated with a particular user, across multiple requests from that user, from the same browser instance. Which two provide this capability from within a tag handler? (Choose two)

Options

  • ApageContext.setAttribute("name", theValue);
  • BpageContext.setAttribute("name", getSession() );
  • CpageContext.getRequest().setAttribute("name", theValue);
  • DpageContext.getSession().setAttribute("name", theValue);
  • EpageContext.setAttribute("name", theValue, PageContext.PAGE_SCOPE);
  • FpageContext.setAttribute("name", theValue, PageContext.SESSION_SCOPE);

How the community answered

(22 responses)
  • A
    9% (2)
  • B
    5% (1)
  • D
    82% (18)
  • E
    5% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-899 Practice