Multiple choice technology programming languages

Servlet A receives a request that it forwards to servlet B within another webapplication in the same web container. Servlet A needs to share data with servlet B and that data mustnot be visible to other servlets in A's web application. In which object can the data that A shares with Bbe stored?

  1. HttpSession

  2. ServletConfig

  3. ServletContext

  4. HttpServletRequest

  5. HttpServletResponse

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

When forwarding requests between servlets in different web applications, the session and servlet context are not shared. HttpServletRequest attributes are preserved during forward operations and are accessible only to the target servlet, making them the ideal mechanism for data sharing in this scenario. HttpSession and ServletContext are shared within the same web application, not across applications.