Forms 数据列表中有多个RemoteCommand,但只有一个调用

Forms 数据列表中有多个RemoteCommand,但只有一个调用,forms,jsf,jsf-2,primefaces,datalist,Forms,Jsf,Jsf 2,Primefaces,Datalist,这是一个棘手的问题,我不明白为什么它是这样工作的: <p:dataList var="item" value="#{recb.friends}" type="definition"> <p:column> <h:form> <p:remoteCommand name="getTaste" process="@this" actionListener="#{

这是一个棘手的问题,我不明白为什么它是这样工作的:

<p:dataList var="item" value="#{recb.friends}" type="definition">
    <p:column>
        <h:form>
            <p:remoteCommand name="getTaste" process="@this" 
                         actionListener="#{item.calculateTaste( recb.username )}"
                         autoRun="true" oncomplete="poll.start()" />    
            <p:poll autoStart="false" update="@form" interval="1"
                widgetVar="poll" oncomplete="poll.stop()" />                    
        </h:form>
    </p:column>
</p:dataList>

因此,我希望发生的是:对于每个
,它将调用
calculatestate
方法。 发生的情况是:只有一个调用,只针对数据列表中的最后一项


我不知道怎么回事。我添加了列以便生成ID,但它仍然不起作用:(.

至于问题的原因,此构造在同一范围内生成多个具有完全相同名称的JS变量,基本上如下所示:

<script>var getTaste = function() { ... }</script>
<script>var getTaste = function() { ... }</script>
<script>var getTaste = function() { ... }</script>
...
这样,生成的代码以唯一的JS变量名结束:

<script>var getTaste0 = function() { ... }</script>
<script>var getTaste1 = function() { ... }</script>
<script>var getTaste2 = function() { ... }</script>
...
var getTaste0=function(){…}
var getTaste1=函数(){…}
var getTaste2=函数(){…}
...
顺便说一下,我也会在
上应用相同的解决方案

<p:dataList ... varStatus="loop">
    ...
    <p:remoteCommand name="getTaste#{loop.index}" ...
        oncomplete="poll#{loop.index}.start()" /> 
    <p:poll ...
        widgetVar="poll#{loop.index}" oncomplete="poll#{loop.index}.stop()" />

...

哦,我的天啊……真是瞎了眼。我在看表单id等。最近我甚至在更正p:remoeCommands的名称,但我没有注意到脚本中生成了什么!非常感谢!
<p:dataList ... varStatus="loop">
    ...
    <p:remoteCommand name="getTaste#{loop.index}" ...
        oncomplete="poll#{loop.index}.start()" /> 
    <p:poll ...
        widgetVar="poll#{loop.index}" oncomplete="poll#{loop.index}.stop()" />