Google Analytics

Monday, December 28, 2015

ADF bean property value set


<af:commandButton text="Cancel" id="cbCan" partialSubmit="true"
actionListener="#{pageFlowScope.XxxBean.cancelOrderAL}"
binding="#{pageFlowScope.XxxUIBean.cbCancelOrder}"
partialTriggers="cb1"
disabled="#{!pageFlowScope.XxxBean.isCancelBtnEnable}"/>

Above code button disable logic in XxxUIBean and cbCancelOrder field is encapsulated.

public void setIsCancelBtnEnable(boolean isCancelBtnEnable) {
this.isCancelBtnEnable = isCancelBtnEnable;
}

public boolean isIsCancelBtnEnable() {
return isCancelBtnEnable;
}

Always use setter methods to set values. If we assign values directly to the field, it shows abnormal behavior (In above case one time button disable and another time button enable). Presentation

No comments:

Post a Comment