Which java code snippet roles “MANAGER” and “EMPLOYEE” in a given application?

Which java code snippet roles “MANAGER” and “EMPLOYEE” in a given application? A. @DeclareRoles({ “MANAGER”, “EMPLOYEE” }) public class MyServlet extends HttpServlet {} B. @SecurityRoles({ “MANAGER”, “EMPLOYEE” }) public class MyServlet extends HttpServlet {} C. @DeclareRoles(“MANAGER”) @DeclareRoles(“EMPLOYEE”) public class MyServlet extends HttpServlet {} D. @DeclareRole(“MANAGER”) @DeclareRole(“EMPLOYEE”) public class MyServlet extends HttpServlet {} Explanation:* The syntax […]

Read More

Which Java expression can be used to check whether the web container is currently configured to track sessions via URL rewriting?

Which Java expression can be used to check whether the web container is currently configured to track sessions via URL rewriting? A. servletContext.getSessionCookiesConfiq() .isHttpOnly() B. servletContext.getSessionCookiesConfiq() .isSecure() C. servletContext.getDefaultSessionTrackingModes() .contains(SessionTrackingMode.URL) D. servletContext.getEffectiveSessionTrackingModes() .contains (SessionTrackingMode.URL) Explanation:Code example:String sessionID = null;if (request.getServletContext().getEffectiveSessionTrackingModes() .contains(SessionTrackingMode.URL)) { // Get the session ID if there was onesessionID = request.getPathParameter(SessionConfig.getSessionUriParamName(request.getContext()));if (sessionID != […]

Read More

Which is true?

Given the definition of Myobject and that an instance of Myobject is bound as a session attribute:8. package com.example;9. public class Myobject implements10. javax.servlet.http.HttpSessionBindingListener {11. // class body code here12. }Which is true? A. Only a single instance of Myobject may exist within a session B. The unbound method of the Myobject instance is called […]

Read More

Which code snippet on line 14, will determine the age of the session?

As a convenience feature, your web pages include an Ajax request every five minutes to a special servlet that monitors the age of the user’s session. The client-sideJavaScript that handles the Ajax callback displays a message on the screen as the session ages. The Ajax call does NOT pass any cookies, but it passes thesession […]

Read More

Which three can be placed at line 23 to retrieve an existing HttpSession object?

Given an HttpServletRequest request:22. String id = request.getParameter(“jsessionid”);23. // insert code here24. String name = (String) session.getAttribute(“name”)Which three can be placed at line 23 to retrieve an existing HttpSession object? (Choose three) A. HttpSession session = request.getSession(); B. HttpSession session = request.getSession(id); C. HttpSession session = request.getSession(true); D. HttpSession session = request.getSession(false); E. HttpSession session […]

Read More

Which two changes, taken together, ensure that value is equal to “Hello” on line 23?

Given that a web application consists of two HttpServlet classes, ServletA and ServletB, and the ServerletA.service method:20. String key = “com.example.data”;21. session.setAttribute(key, “Hello”);22. object value = session.getAttribute(key);23.Assume session is an HttpSession, and is not referenced anywhere else in ServletA. Which two changes, taken together, ensure that value is equal to “Hello” online 23? (Choose two) […]

Read More

Which two provide this capability from within a tag handler?

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 samebrowser instance. Which two provide this capability from within a tag handler? (Choose two) A. pageContext.setAttribute(“name”, theValue); B. pageContext.setAttribute(“name”, getSession() ); C. pageContext.getRequest().setAttribute(“name”, theValue); D. pageContext.getSession().setAttribute(“name”, theValue); E. pageContext.setAttribute(“name”, theValue, […]

Read More

which three jsp:setProperty attributes must be used to initialize its properties from the HTML form?

View the Exhibit. Given:10. <form action=`create_product.jsp’>11. Product Name: <input type= `text’ name=`productName’/><br/>12. Product Price: <input type= `text’ name=`productPrice’/><br/>13. </form>For a given product instance, which three jsp:setProperty attributes must be used to initialize its properties from the HTML form? (Choose three.) A. id B. name C. type D. param E. property F. reqParam G. attribute Show […]

Read More