Java EE 7 Application Developer — Question 27
Your web application requires logic to remember items that a user placed into a shopping cart.
Which two mechanisms should you use to associate that information with the user? (Choose two.)
Answer options
- A. HttpServletResponse objects
- B. ServletContext objects
- C. HttpSession objects
- D. a database
Correct answer: B, C
Explanation
The correct answers are B and C because ServletContext objects allow shared data across servlets and users, while HttpSession objects are specifically designed to maintain user-specific data during a session. HttpServletResponse objects are used for sending responses to the client, and a database is not directly used for session management in this context.