O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introducing the RequestContext utility

RequestContext is a utility class provided by PrimeFaces with the following features, which come in handy at times:

  • Update UI components from Managed Bean methods programmatically
  • Execute JavaScript from Managed Bean methods
  • Add AJAX callback parameters
  • ScrollTo a specific component after the AJAX update

The RequestContext utility class can be used with both AJAX and Non-AJAX requests. We can also use the requestContext.isAjaxRequest() method to determine whether the current request is an AJAX or Non-AJAX request.

Updating UI components

Normally we use the update attribute to specify the component ID(s) that needs to be updated after an AJAX request is completed.

We can also update the components using the org.primefaces.context.RequestContext ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required