Java EE 7 Application Developer — Question 47
Which type allows you to share servlet attributes across your entire web application?
Answer options
- A. ServletContext
- B. HttpSession
- C. ServletRequest
- D. ServletConfig
Correct answer: A
Explanation
The correct answer is A, ServletContext, as it provides a way to share attributes across all servlets in the application. HttpSession (B) is limited to a single user's session, ServletRequest (C) is confined to a request's lifecycle, and ServletConfig (D) is specific to an individual servlet's configuration.