我想使用已经对我有用的omnifaces推送通知。唯一的问题是,一旦收到推送通知,容器就不会更新。仅刷新页面。
我想tu更新我的响铃图标: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"