我尝试使用 RequestContext 在我的 xhtml 页面中调用 javascript 函数,但我无法成功。有没有办法从 prime faces 的 View bean 调用 javascript 函数?
如果问题不清楚,我可以提供代码。
最佳答案
就像@Parkash Kumar 说的,你可以从 bean 中调用它,像这样:
RequestContext.getCurrentInstance().execute("alert('script called.')");
或直接从 xhtml:
<p:commandButton value="Save" actionListener="#{requestContextView.save}" oncomplete="handleComplete(xhr, status, args)" />
关于javascript - 有一种方法可以从 primefaces 调用 javascript 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44639088/