Javascript function call when receiving ajax response in JSF 2.0

I use JSF 2.0 and the new (actually old, but now built-in JSF) ajax functions.

I have something like this:

<h:inputText id="name" value="#{coordinatesMBean.name}"/>
<h:commandButton value="Reverse me!">
  <f:ajax execute="name" render="reverseName"/>
</h:commandButton>
<h:outputText id="reverseName" value="#{coordinatesMBean.reverseName}"/>

It works fine, after clicking the button, the value from inputText is sent to the server, placed in a managed bean, and reverseNameoverwritten with new data.

What I want to do is not only retransmission reverseName, but also calling some Javascript function when receiving an ajax response.

+3
source share
1 answer

<f:ajax>has attributes oneventand onerror. Give it a try.

Alternatively, Richfaces <a4j:support>has an attribute oncompletefor this purpose.

+4
source

Source: https://habr.com/ru/post/1735030/


All Articles