I understand the ServletContext, I understood the very essence, using this interface we can get information about the environment in which the servlet is running, but I don’t understand who can explain the available data and where in practice I can understand

1 answer 1

ServletContext is a resource that is available within a session or in an HttpSession object that can be obtained from HttpServletRequest, which is available in all classes involved in processing http requests, respectively ServletContext is usually used as a session scope resource in the controller or the presentation of standard MVC applications.

And more ... A shared resource is used to exchange data between independent components of an application, such as variable scopes of a class, in particular cases they are used to exchange data between class methods.

  • one
    What makes you think that ServletContext can be used as a Session Scope resource? - cache