由于PrimeFaces已弃用Push,因此我试图在GlassFish 5中使JSF 2.3正常运行。但是,我在解雇侦听器时遇到了麻烦。
我有以下代码:
@Inject
@Push(channel = "notifyjsf")
private PushContext push;
push.send("price");
logger.log(Level.INFO, "price push");
我的问题是触发我的通知功能。如果我按以下方式设置onmessage,则根本不会触发:
<f:websocket channel="notifyjsf" onmessage="notifyListener" />
我也收到IntelliJ的警告,“ Expression语句不是赋值或调用”
但是,如果我这样做:
<f:websocket channel="notifyjsf" onmessage="notifyListener(message,channel,event)" />
监听器被解雇了,但是我得到一个错误:
"VM36:1 Uncaught ReferenceError: message is not defined
at eval (eval at <anonymous> (jquery.js.xhtml?ln=primefaces&v=6.1:14), <anonymous>:1:172)
我的听众代码在下面
function notifyListener(message, channel, event) {
console.log("notifyListener message: " + message);
console.log("notifyListener channel: " + channel);
console.log("notifyListener event: " + event);
console.log("stocks: notifyListener");
}
谢谢, Zobbo