Is it possible in JSF2 from a custom component (in method encodeBegin) to access to the FacesContext and managed beans?
Thanks you.
Yes. Even more, the FacesContext
is available as method argument of encodeBegin()
method.
Then, to access managed beans, use Application#evaluateExpressionGet()
.
Bean bean = (Bean) context.getApplication().evaluateExpressionGet(context, "#{beanName}", Bean.class);