Postback and AJAX
Throughout this book, we have mentioned the postback request several times. For those who are not familiar with it, or just need a quick reminder, let's say that JSF recognizes the initial request and the postback request.
Initial request (for example, HTTP GET
) is the first request that the browser sends for loading the page. You can obtain such a request by accessing the application URL in a browser or by following a link (it can be a link to any page of the application). Moreover, the initial request happens in page_B
when page_A
contains a redirection (faces-redirect=true
) to page_B
(this is not true for forwarding mechanism). This kind of request is processed in Restore View phase and Render Response phase.
Postback request happens when we click on a button/link for submitting a form. Unlike the initial request, the postback request passes through all the phases.
JSF provides a method named
isPostback
that returns a Boolean value: it returns true
for postback request...