单击h:selectOneRadio显示选项

时间:2012-05-11 09:35:47

标签: jsf primefaces

我有一个单选按钮,我希望在选择后显示与其相关的几个选项..选项在相关的bean上。我该怎么做?

<h:panelGrid columns="2" cellpadding="0" cellspacing="0" >
    <h:selectOneRadio value="#{managePaymentModel.reportFilter.options}" layout="pageDirection" label="Select Option" disabled="#{managePaymentModel.reportPreview}">
        <f:selectItems value="#{managePaymentModel.reportOptions}" var="type" itemValue="#{type.value}" itemLabel="#{type.label}" />
    </h:selectOneRadio>
</h:panelGrid>
@Override
public Map reportSelector() {
    Map<Integer, String> map = new HashMap<Integer, String>();
    map.put(ManagePaymentBeanLocal.LIST_PAYMENTS_SUMMARY, "List of Payments Summary");
    map.put(ManagePaymentBeanLocal.LIST_PAYMENTS_DETAIL, "List of Payments Detail");
    return map;
}
@Override
public Map reportOptions(ReportFilter filter) {
    Map<Integer, String> option = new HashMap<Integer, String>();
    // report configurations
    switch (filter.getSelect()) {
        case ManagePaymentBeanLocal.LIST_PAYMENTS_SUMMARY:
        case ManagePaymentBeanLocal.LIST_PAYMENTS_DETAIL:
            option.put(ReportFilter.OPTION1, "By Beneficiary");
            option.put(ReportFilter.OPTION2, "By Reference");
            break;
    }
    return option;
}

1 个答案:

答案 0 :(得分:0)

您可以将此代码放入selectOneRadio

<f:ajax event="change" render="@form" />

这将更新后面的模型并重新处理处方集