Primefaces RequestContext under 7.0
Asked Answered
G

1

20

My pre-7.0 Primefaces application has this code:

RequestContext.getCurrentInstance().execute("window.open('myUrl');");

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

Gilolo answered 21/3, 2019 at 16:57 Comment(2)
In PF 6.2 all these calls are deprecated with appropriate hint.Antoinetteanton
Its all in the migration guide: github.com/primefaces/primefaces/wiki/Migration-GuideSatan
A
36

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');");

Please keep looking into the migration guide (already linked by @Melloware in comment) when upgrading your Primefaces dependency.

Antoinetteanton answered 21/3, 2019 at 17:9 Comment(2)
Maybe add some text as well, e.g. from your commentRandolph
@Randolph Why text? Just kidding - planned so too and hoped to find a PF 'migration guide' I can refer to but I could not manage to open the docs on mobile yet. But on the first go I wanted to send a hello to the VLQQ ;DAntoinetteanton

© 2022 - 2024 — McMap. All rights reserved.