ajax事件没有在JSF中触发

时间:2014-02-10 08:13:49

标签: ajax jsf

我无法触发Ajax事件并调用actionListener或使第二个选择更新自身。我错过了什么?

<p:selectOneMenu value="#{player}"
                converter="playerConverter" id="playerList">
            <f:selectItem itemLabel="---" noSelectionOption="true" />
            <f:selectItems value="#{servicePlayer.allPlayers}"
             var="n"
             itemValue="#{n}"
             itemLabel="#{n.combinedName}"
             itemLabelEscaped="true"/>
              <p:ajax event="change" execute="@this" actionListener="#
{serviceHCP.getClubs(player) }" update="ClubMenu" />
                </p:selectOneMenu>

                    <h:outputText value="Klubb"></h:outputText>
                    <!--  h:outputText value="#{ serviceHCP.myClubList.size()}" / -->

                    <p:selectOneMenu id="ClubMenu" value="#{serviceHCP.myCurrentClub}" rendered="#{not empty serviceHCP.myClubList}"
                    converter="clubConverter">
                        <f:selectItems value="#{serviceHCP.myClubList}"
                         var="clb"
                         itemValue="#{clb}"
                         itemLabel="#{clb.name}"
                         itemLabelEscaped="true"/>
                    </p:selectOneMenu>
                    <h:outputText value="Serietyp"></h:outputText>

1 个答案:

答案 0 :(得分:2)

非常愚蠢的错误

selectOneMenu ajax events

它不被称为actionListener,它被称为侦听器。

<p:ajax event="change" execute="@this" actionListener="#{serviceHCP.getClubs(player) }" update="ClubMenu" />

正确

<p:ajax event="change" execute="@this" listener="#
{serviceHCP.getClubs(player) }" update="ClubMenu" />