Is it a non-AJAX request?
JSF can answer this question by inspecting request headers or checking the PartialViewContext.isAjaxRequest
method. The request headers that provide information about the request type are Faces-Request
and X-Requested-With
. For an AJAX request, the Faces-Request
header will have the value partial/ajax
, while the X-Requested-With
request type will have the value XMLHttpRequest
(in JSF 2.2, X-Requested-With
doesn't seem to work; however, for the sake of completeness, you can test them again). In the following screenshot, you can see the headers of a typical JSF 2.2 AJAX request:
In a managed bean, you can determine the type ...
Get Mastering JavaServer Faces 2.2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.