Example code:
component.add(new AjaxFormChoiceUpdatingBehavior(){
@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxCallDecorator(){
@Override
public CharSequence decorateOnFailureScript(
CharSequence script) {
return "alert('There is a problem with ajax call')"
+ script;
}
};
}
@Override
protected void onUpdate(AjaxRequestTarget target) {
// code goes here ... when component gets updated.
}
});
Bottom line is that be careful while handling ajax calls. :)