Reputation: 22011
Is there a way to access JSF managed beans from a servlet?
Upvotes: 5
Views: 2828
Reputation: 1109542
In a Servlet, you can get request scoped beans by:
Bean bean = (Bean) request.getAttribute("beanName");
and session scoped beans by:
Bean bean = (Bean) request.getSession().getAttribute("beanName);
and application scoped beans by:
Bean bean = (Bean) getServletContext().getAttribute("beanName");
Upvotes: 9