Tuesday, February 23, 2016

Component Reference

One way to get component reference is use JSFUtils UIComponent component = JSFUtils.findComponentInRoot("contextPopup"); Another way is below We should not have any Rich component in backing bean because of serialization and memory issues Sample of popup binding changed to component reference private ComponentReference conflictReadOnlyPopup; The getter and setter looks like public void setConflictReadOnlyPopup(RichPopup conflictReadOnlyPopup) { this.conflictReadOnlyPopup = ComponentReference.newUIComponentReference(conflictReadOnlyPopup); } public RichPopup getConflictReadOnlyPopup() { RichPopup retVal = null; if(conflictReadOnlyPopup != null) retVal = (RichPopup) conflictReadOnlyPopup.getComponent(); return retVal; } Now to access any popup property you will have to usig the get method eg. getConflictReadOnlyPopup().hide();