o:commandScript - 推送后更新 h:panelGroup

o:commandScript - update h:panelGroup after push

我想使用已经为我工作的 omnifaces 推送通知。 唯一的问题是容器没有在我收到推送通知后立即更新。只有页面刷新。

我想更新我的铃铛图标: Bell Icon

这是我的代码结构... Code

这是我的代码 JSF:

    <h:form id="notificationPushTopbarForm">
    <o:socket channel="notificationChannel"
        user="#{loginBean.currentEmployee.id}" scope="view"
        onmessage="someTestScript">
    </o:socket>

    <o:commandScript name="someTestScript"
        actionListener="#{numberOfUnreadNotificationByEmployeeNotLazyController.findNumberOfUnreadNotification()}"
        immediate="true" render="@parent:topbar_container, :notificationTopbarForm" />

</h:form>

    <h:panelGroup id="topbar_container" styleClass="topbar" layout="block">

    <ul class="topbar-menu">

        <li><p:commandLink id="notificationLink" global="true"
                update=":notificationTopbarForm" resetValues="true"
                oncomplete="PF('notificationSidebar').show()" ajax="true"
                process="@this">
                <i class="topbar-icon fa fa-fw fa-bell-o"></i>
                <h:outputText id="notificationTopbar"
                    value="#{numberOfUnreadNotificationByEmployeeNotLazyController.numberOf}"
                    rendered="#{numberOfUnreadNotificationByEmployeeNotLazyController.numberOf != 0}"
                    styleClass="topbar-badge animated FontBold rubberBand" />
                <h:outputText value="Benachrichtungen"
                    styleClass="topbar-item-name" />
            </p:commandLink> <p:tooltip for="notificationLink" value="Benachrichtungen"
                position="bottom" /></li>

知道我做错了什么吗

将更新属性更改为以下内容:

render=":topbar_container :notificationTopbarForm"