Primefaces RequestContext under PF 7

UI Components for JSF
Post Reply
jenni03
Posts: 26
Joined: 21 Jul 2010, 20:53

05 Aug 2021, 04:07

Hello,
We tried to upgrade our application from Primeface 6 to 7. By reading the following migration guide and looking up from API method in primefaces 6.2. It suggested using "PrimeFaces.ajax().update()" to replace the "update" method from RequestContext class, however, I tried it out in our application and found it didn't work.

As the upgrade to PF 7 caused many compilation errors in our PF 6 application, I'd like to confirm with you if my following approach is on the track or not before I do whole code refactor:
[
RequestContext has been replaced by PrimeFaces.current(). RequestContext is still available as PrimeRequestContext but it's internal PrimeFaces API and should therefore be avoided to use
.

https://www.javadoc.io/doc/org.primefac ... ntext.html

Code: Select all

@Deprecated
public abstract void update(String name)
Deprecated. Use PrimeFaces.ajax().update() instead
Our Primeface 6 application has this code:

Code: Select all

RequestContext context = RequestContext.getCurrentInstance();
context.update("removeForm");
The equivalent new code to use Primefaces 7:

Code: Select all

   
   PrimeFaces context = PrimeFaces.current();
   context.ajax().update("removeForm");
 
It would be great if you can let me know if this approach is correct or not. Your help will save us lots of refactoring time and we do appreciate it.
Thanks in advance!

Primefaces 7.0
JSF 2.3
JDK 11
Weblogic 14
Primefaces 6.0
JSF 2.2
Tomcat 7

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

05 Aug 2021, 14:03

Yes what you have is correct.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

jenni03
Posts: 26
Joined: 21 Jul 2010, 20:53

05 Aug 2021, 15:42

Great! Thanks very much for your confirmation!
Primefaces 6.0
JSF 2.2
Tomcat 7

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests