DD.
DD.

Reputation: 22011

JSF Managed Beans in a Servlet

Is there a way to access JSF managed beans from a servlet?

Upvotes: 5

Views: 2828

Answers (1)

BalusC
BalusC

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

Related Questions