Propagating Client-Side View State

If your application stores view state on the client, you must propagate that state with your Ajax calls if you need access to view state.

To propagate view state, we implement a JavaScript function called getJSFState, which we call when the Zip Code changes.


The getJSFState function returns a string that we pass through to the request as a request parameter named javax.faces.ViewState. That string is the serialized version of the current component tree, which JSF previously stored in a hidden field named javax.faces.ViewState:

To get the serialized view state, we access the value of the hidden field with the ...

Get AJAX and JavaServer™ Faces now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.