3

I'm using JSF 2.0 and it's new (actually old, but now incorporated in JSF) ajax features.

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 hitting button value from inputText is sent to server, put into managed bean, and reverseName is rerendered with new data.

What I want to do is not only rerendering reverseName, but also call some Javascript function when ajax response is received.

1 Answer 1

4

<f:ajax> has onevent and onerror attributes. Give them a try.

Alternatively, Richfaces <a4j:support> has the oncomplete attribute for that purpose.

Sign up to request clarification or add additional context in comments.

2 Comments

I think oncomplete is what I need. onevent is fired when request is sent to server, before response is received and handled, right? So it's not good for me.
Ok, onevent is triggered 3 times, with different statuses: 1. when ajax request is sent to server (I don't remember the status) 2. when response is received (status = complete) 3. also when response is received (status = success)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.