是否可以定期更新页面<title>
的文本?例如<p:poll>
?还是我需要重新加载整页?我想显示我的后备 bean 中的一个值。
任何帮助将不胜感激!
我通过使用PrimeFaces的RequestContext解决了它:
RequestContext context = RequestContext.getCurrentInstance();
context.execute("document.title='Number: " + number + "'");
我将这段代码添加到我的后备 bean 中的一个方法中,该方法作为<p:poll>
的效果定期执行。
感谢您的指示马特·汉迪!