【问题标题】:Updating <title> text in JavaServer Faces 2 + PrimeFaces 3.3.1在 JavaServer Faces 2 + PrimeFaces 3.3.1 中更新 <title> 文本
【发布时间】:2012-06-22 08:52:34
【问题描述】:

是否可以定期更新页面的&lt;title&gt; 的文本?例如&lt;p:poll&gt;?还是我需要为此重新加载整页?我想从我的支持 bean 中显示一个值。

任何帮助将不胜感激!

【问题讨论】:

标签: ajax jsf primefaces


【解决方案1】:

我通过使用 PrimeFaces 的RequestContext 解决了这个问题:

RequestContext context = RequestContext.getCurrentInstance();
context.execute("document.title='Number: " + number + "'");

我将此代码添加到我的支持 bean 中的一个方法中,该方法作为 &lt;p:poll&gt; 的效果定期执行。

感谢Matt Handy的指导!

【讨论】:

    猜你喜欢
    • 2011-08-31
    • 1970-01-01
    • 1970-01-01
    • 2014-04-20
    • 2012-04-15
    • 2011-08-02
    • 2014-02-10
    • 2011-06-28
    • 2019-10-20
    相关资源
    最近更新 更多