Getting and setting Managed Bean objects in JSF
Posted on 08. Apr, 2007 by Tahir Akram in Development
Get appplication from FacesContext
FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
Setting in Managed Bean Object
app.createValueBinding("#appSessionBean.userDataBean}").setValue(ctx, userDataBean);
Getting Managed Bean Object(s)
AppSessionBean appSessionBean = (AppSessionBean)app.createValueBinding("#{appSessionBean}").getValue(ctx);
userDataBean = (UserDataBean)appSessionBean.getUserDataBean();
where userDataBean is object in ApplicationSessionBean class and this said class is in faces-config with session scope.


