7.0 下的 Primefaces RequestContext [英] Primefaces RequestContext under 7.0
问题描述
我 7.0 之前的 Primefaces 应用程序具有以下代码:
My pre-7.0 Primefaces application has this code:
RequestContext.getCurrentInstance().execute("window.open('myUrl');");
我了解 RequestContext 在 7.0 中不再可用.执行相同操作的等价物是什么?
I understand that RequestContext is no longer available in 7.0. What is the equivalent to perform the same action?
推荐答案
除了其他更改之外,RequestContext
类已在 6.2 版中弃用,并在 Primefaces 7.0 版中删除.它被调用 PrimeFaces.current()
替换.在您的情况下,代码应更改为:
Beside other changes the RequestContext
class has been deprecated in version 6.2 and removed in version 7.0 of Primefaces. It is replaced by calling PrimeFaces.current()
. In your case, the code should be changed to:
PrimeFaces.current().executeScript("window.open('myUrl');");
请继续查看迁移指南(已由@Melloware 在评论)升级您的 Primefaces 依赖项时.
Please keep looking into the migration guide (already linked by @Melloware in comment) when upgrading your Primefaces dependency.
这篇关于7.0 下的 Primefaces RequestContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!