Set attribute into JSP PageContext for use in EL from a Filter
How can I put an attribute开发者_JS百科 into the JSP PageContext for the current request (so that it becomes accessible via ${myVar}
) from a Filter that runs before the JSP?
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);
精彩评论