h:selectOneRadio in JSF

<h:selectOneRadio value="#{testBean.paymentBalance}"
layout="pageDirection" rendered="#{testBean.oneTimePaymentIncluded}">
<f:selectItems value="#{testBean.paymentAmounts}" />
</h:selectOneRadio>


public ArrayList<SelectItem> getPaymentAmounts() {
ArrayList<SelectItem> paymentAmounts = new ArrayList<SelectItem>();

SelectItem currentBalance = new SelectItem();
currentBalance.setLabel("CurrentBalance " + getWholePaymentBalance());
currentBalance.setValue("CurrentBalance");
paymentAmounts.add(currentBalance);

SelectItem lateBalance = new SelectItem();
lateBalance.setLabel("PastDueBalance " + getPastDueBalance());
lateBalance.setValue("PastDueBalance");
paymentAmounts.add(lateBalance);

SelectItem otherBalance = new SelectItem();
otherBalance.setLabel("OtherBalance");
otherBalance.setValue("OtherBalance");
paymentAmounts.add(otherBalance);

return paymentAmounts;
}

0 comments: