JSF 2 f:ajax why execute onevent three times?

Recently when I doing <f:ajax> inside JSF 2.0, I specify onevent javascript callback function, when f:ajax execute to the server and return to the client, it will call the javascript callback function. But I discovered that it will call the function three times. Afterwards when I checked the Javascript Console Log in Google, I discovered onevent will have three different status when it called the function.

The status are: begin, complete, success.

Therefore, the problem has known. We just have to define an onevent callback function as below.

function onevent(e) {
    if(e.status == ‘success’) {
        // TODO: your business
    }
}

Author: fyhao

Jebsen & Jessen Comms Singapore INTI University College Bsc (Hon) of Computer Science, Coventry University

3 thoughts on “JSF 2 f:ajax why execute onevent three times?”

  1. Hi,

    I recently used the onevent function for a UI block call and even i was confused how it worked. The status changes are actually helpful for us to call different actions on different times gap.

    Rgds,

    Gayan

Leave a Reply