what is data.foo syntax in JSF/Rich Faces?
Say for example,
<a4j:support event="onchange" action="#{bean.retrieveStates}"
reRender="states_dropDown" data="#{student}"></a4j:support>
i am passing student object in data attribute. can I access in managed bean? Documentation says this "Serialized (on default with JSON) data passed on the client by a developer on AJAX request. It's accessible via "data.foo" syntax "
can some one please explain.
From this blogpost:
Another attribute is data, which allows you to get any additional data from the server during an Ajax request. The data attribute can simply point to a bean property via EL, and the data will be serialized in JSON format and available on the client side. Here’s an example:
<a4j:commandButton value="Submit" reRender="out"
data="#{bean.text}"
oncomplete="alert(data)"/>
So yes - you can access any attribute of the managed bean and reference it (most often) in oncomplete.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With