0
<h:form>

        <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">

            <h:outputText value="Region: " />
            <p:selectOneMenu id="regionSelection" value="#{haf.selectedRegion}" effect="fade">
                <f:selectItem itemLabel="Select One" itemValue="" />
                <f:selectItems value="#{haf.regions}" var="region"
                    itemLabel="#{region.regionName}" itemValue="#{region.regionCode}" />
                <p:ajax listener="#{haf.selectRegion}" update="provinceSelection" />
            </p:selectOneMenu>

            <h:outputText value="Province: " />
            <p:selectOneMenu id="provinceSelection" value="#{haf.selectedProvince}" effect="fade">
                <f:selectItem itemLabel="Select One" itemValue="" />
                <f:selectItems value="#{haf.provinces}" var="province"
                    itemLabel="#{province.provName}" itemValue="#{province.provCode}" />
                <p:ajax listener="#{haf.selectProvince}" update="citySelection" />
            </p:selectOneMenu>

            <h:outputText value="City/Municipality: " />
            <p:selectOneMenu id="citySelection" value="#{haf.selectedCity}" effect="fade">
                <f:selectItem itemLabel="Select One" itemValue="" />
                <f:selectItems value="#{haf.cities}" var="city"
                    itemLabel="#{city.cityName}" itemValue="#{city.cityCode}" />
                <p:ajax listener="#{haf.selectCity }" update="brgySelection" />
            </p:selectOneMenu>

            <h:outputText value="Barangay: " />
            <p:selectOneMenu id="brgySelection" value="#{haf.selectedBrgy}"
                effect="fade">
                <f:selectItem itemLabel="Select One" itemValue="" />
                <f:selectItems value="#{haf.brgys}" var="brgy"
                    itemLabel="#{brgy.brgyName}" itemValue="#{brgy.brgyCode}" />
            </p:selectOneMenu>

        </h:panelGrid>
    </h:form>

请问关于代码的问题是什么......第一个ajax触发但第二个没有。JSF 有规则、1 个表单、1 个 ajax 吗?提前感谢您回答一个幼稚的问题。

4

0 回答 0