Primefaces RequestContext under 7.0

Tom*_*m T 8 primefaces

My pre-7.0 Primefaces application has this code:

RequestContext.getCurrentInstance().execute("window.open('myUrl');");
Run Code Online (Sandbox Code Playgroud)

I understand that RequestContext is no longer available in 7.0. What is the equivalent to perform the same action?

Sel*_*ron 13

除其他更改外,RequestContext该类在6.2版中已弃用,并在Primefaces 7.0版中删除。它由代替PrimeFaces.current()。在您的情况下,代码应更改为:

PrimeFaces.current().executeScript("window.open('myUrl');");
Run Code Online (Sandbox Code Playgroud)

升级Primefaces依赖项时,请继续查看迁移指南(已通过@Melloware链接在注释中)。