gpt4 book ai didi

jsf - Primeface的remoteCommand - 有办法执行一次吗?

转载 作者:行者123 更新时间:2023-12-02 03:38:35 25 4
gpt4 key购买 nike

Primefaces 3.5 JSF 2.1

我正在使用 p:remoteCommand 执行异步命令并在页面加载后更新我的 View ,但看起来在每次迭代结束时它会再次执行等等...

这种行为正确吗?

如何只执行一次p:remoteCommand?

更新

我已经检查过我的remoteCommand不在更新面板中,所以感谢您的回答,但已经可以了。我如何解决我的问题:

我不知道为什么,但使用 Omnifaces ( http://showcase.omnifaces.org/components/onloadScript ) 中的 onloadScript 来调用它被调用多次的 RemoteCommand 函数,但使用 $(document).ready ...仅一次。所以,我改变了它,现在就可以使用了。

最佳答案

如果您最终陷入类似行为的无限循环,您可能会将父组件更新为 <p:remoteCommand>

<h:form id="myform">
<p:remoteCommand update="myform" actionListener="#{remoteCommandView.execute}" />
...
</h:form>

将其放在您要更新的组件的外部/旁边,一切应该没问题。

<h:form id="newform">
<p:remoteCommand update="myform" actionListener="#{remoteCommandView.execute}" />
</h:form>
<h:form id="myform">
...
</h:form>

关于jsf - Primeface的remoteCommand - 有办法执行一次吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23980848/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com