0

下面是正在使用的代码片段。当我从下面的代码中删除渲染属性时,监听器被调用。但是使用渲染,它不会调用侦听器。我的 PrimaryContactHomeAddressBean bean 位于 RequestScope 中,而 AddressManagedBean 具有 ViewScope。

<p:outputPanel id="countyPanel">
            <p:panelGrid
                id="primaryContactHomeZipPanel" rendered="#{address.isMultipleCounty eq 'Yes'}">
                <h:outputLabel for="primaryContactHomeCounty">
                    </h:outputLabel>
                <p:selectOneMenu id="primaryContactHomeCounty"
                    value="#{addressManagedBean.countyName}">
                    <f:selectItems value="#{addressManagedBean.countyListDropdown}" />
                        <p:ajax listener="#{primaryContactHomeAddressBean.saveCountyName}" process="@this"  update="primaryContactHomecountyName" partialSubmit="true"></p:ajax>
                </p:selectOneMenu>
                <p:message for="primaryContactHomeCounty" />


            </p:panelGrid>
        </p:outputPanel>
4

2 回答 2

0

isMultipleCounty我可以通过将变量移动到ViewScopedBean来解决这个问题,即AddressManagedBean.

于 2015-06-18T09:34:56.257 回答
-1

This line does not follow the JavaBean standards.

rendered="#{address.isMultipleCounty eq 'Yes'}"

If the getter begins with is, then it is supposed to return a boolean, but here you are checking for a String. If it is returning a boolean, then remove the eq 'Yes', regardless rename it multipleCounty.

于 2015-06-18T06:10:43.537 回答