users@javaserverfaces.java.net

Beans talking to other beans

From: Arinté <arintejr_at_gmail.com>
Date: Tue, 04 Dec 2007 16:19:05 -0500

Ok so a rule states that a bean set to application cannot access a bean that is
set to request. But my question is what is the easiest/cleanest way for one
bean to get access to another?

Right now I am doing this:
         FacesContext fc = FacesContext.getCurrentInstance();
         ValueExpression ve =
fc.getApplication().getExpressionFactory().createValueExpression(fc.getELContext(),"#{user}",
User.class);
         User u = (User)ve.getValue(fc.getELContext());

Surely, there is a faster less verbose way?