I\'m trying to inject the value of one sessionscoped bean into a viewscoped bean but it keeps returning null, here\'s a snippet:
import javax.faces.applicati
Recently I have problem with injecting nested managed bean properties by @ManagedProperties too. Once injected it never changed. I did a workaround by evaluating EL in getter instead of injecting it.
Try that:
public String getUserName() {
FacesContext context = FacesContext.getCurrentInstance();
return (String) context.getApplication().evaluateExpressionGet(context,"#{user.userName}", String.class);
}
You can also try injecting entire user bean and get userName field from it in getter.