Search code examples
javajspjsp-tags

Is PageContext shared between Sessions or Requests in JAVA?


In my custom tag library I'm using the pageContext: is it shared between requests of different HttpSession? Is it shared between requests of the same HttpSession? Is it created for every Requests that access the page?


Solution

  • The PageContext is not shared between HttpRequest instances. It's scope is narrower than the one of a request and is bound to a single JSP page execution. There can be few page contexts within a request (via include or forward) and it contains handles to request and session (among other) objects