Set attribute into JSP PageContext for use in EL from a Filter
-
19-09-2019 - |
Question
How can I put an attribute into the JSP PageContext for the current request (so that it becomes accessible via ${myVar}
) from a Filter that runs before the JSP?
Solution
I think I may be missing something, but:
- you have the
ServletRequest
object in the filter - call
request.setAttribute("myVar", value);
- call
chain.doFilter(request, response);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow