What is the result when a request is sent to MyServlet?

Given the definition of MyServlet:
11. public class MyServlet extends HttpServlet {
12. public void service(HttpServletRequest request,
13. HttpServletResponse response)
14. throws ServletException, IOException {
15. HttpSession session = request.getSession();
16. session.setAttribute("myAttribute","myAttributeValue");
17. session.invalidate();
18. response.getWriter().println("value=" +
19. session.getAttribute("myAttribute"));
20. }
21. }
What is the result when a request is sent to MyServlet?
A. An IllegalStateException is thrown at runtime.
B. An InvalidSessionException is thrown at runtime.
C. The string “value=null” appears in the response stream.
D. The string “value=myAttributeValue” appears in the response stream.

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.