Icefaces 和 javascript 桥

发布于 2024-08-02 00:19:05 字数 350 浏览 4 评论 0原文

我遇到了 Icefaces 的问题,它是 javascript 桥。 我不知道在服务器端进行更改后,该桥发生了哪些变化。

例如:我的页面中有一个 ice:panelPopup 组件,其可见属性 =“#{bean.customPopUp}”。 如果我将“bean.customPopUp”更改为“true”,弹出窗口将正确显示,但我需要知道的是:客户端中发生了什么,换句话说,我需要知道是否显示弹出窗口我需要使用 javascript 进行一些客户端处理

I'm facing a problem with Icefaces and it's javascript bridge.
I don't know what are the changes which made by this bridge after i made a changes in the server-side.

For example: I have a ice:panelPopup component in my page with the visible attribute = "#{bean.customPopUp}". If i changed the "bean.customPopUp" to be "true" the popup is displayed correctly, but what i need to know : what happened in the client, in other word, i need to know if the popup is displayed i need to do some client processing using javascript

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随遇而安 2024-08-09 00:19:05

我也一直在尝试寻找组件级回调的解决方案。 这个问题似乎没有一个好的解决方案。 我在 Javascript 中启动了一个递归轮询函数,该函数在检测到组件更新后处理我的任务。 我的支持 bean 启动 poller() 并每 500 毫秒运行一次,直到发生组件更新。

var pollingCount = 0;
var previousValue;

function poller() {
    // Kill poller after 30 seconds
    if (pollingCount >= 60) {
        pollingCount = 0;
        return;
    }

    var currentValue = document.getElementById('myInputElement').value;
    if (previousValue != currentValue) {
        previousValue = currentValue;
        pollingCount = 0;
        myFunction();
    }
    else {
        pollingCount++;
        setTimeout('poller()', 500);
    }
}

我的支持者:

updateDataModel(); // Causes 'myInputElement' component to update

FacesContext fc = FacesContext.getCurrentInstance();
JavascriptContext.addJavascriptCall(fc, "poller();");

我不太喜欢这个解决方案,但目前似乎没有任何好的答案。

I've been trying to find a solution for component level callbacks also. There doesn't appear to be a good solution to this problem. I've resorted to initiating a recursive polling function in Javascript that handles my task after it detects an update to my component. My backing bean starts the poller() and it runs every 500ms until the component update has occurred.

var pollingCount = 0;
var previousValue;

function poller() {
    // Kill poller after 30 seconds
    if (pollingCount >= 60) {
        pollingCount = 0;
        return;
    }

    var currentValue = document.getElementById('myInputElement').value;
    if (previousValue != currentValue) {
        previousValue = currentValue;
        pollingCount = 0;
        myFunction();
    }
    else {
        pollingCount++;
        setTimeout('poller()', 500);
    }
}

My backing bean:

updateDataModel(); // Causes 'myInputElement' component to update

FacesContext fc = FacesContext.getCurrentInstance();
JavascriptContext.addJavascriptCall(fc, "poller();");

I don't like this solution very much, but there don't appear to be any great answers at this time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文