通过 JS 调用 JSF 方法 [英] Call a JSF method via JS
本文介绍了通过 JS 调用 JSF 方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 JS 代码中有一个 for 循环,我想调用一个用 JAVA 托管 bean 编写的参数的方法,该方法计算一个值并返回一个将在 JS 中使用的新值注意:我在 xhtml 页面中使用了primefaces并且可以手动显示数据
i have a for loop in JS code, i want to call a method with parameters written in a JAVA managed bean that calculate a value and return a new one that will be used in the JS Note: i'm using primefaces in the xhtml page and handsontable to display data
这就是我的 js 的样子
that's how my js looks like
function updateMoneyValue(){
var thetable; //the handsonTable
for (var i =0 ; i < thetable.length ; i++)
{
var myNewValue = theBeanMethod (firstParam , secondParam);
}
}
推荐答案
您可以使用 primefaces remoteCommand 组件.您可以在这篇博文中找到有关 remoteCommand 的详细信息.
you can use primefaces remoteCommand component. you can find details about remoteCommand in this blog post.
这篇关于通过 JS 调用 JSF 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文