Thursday, April 28, 2011

Interrupt a JSF Ajax request

Hello

I have a JSF application, in which a RichFaces modal panel is shown using a4j:status while an ajax request is being handled by my backing bean. I want to put a cancel button on the modal panel so a user can interrupt the request.

What is the best way to do this? I'm thinking of something like having the cancel a4j:commandButton call an action on the bean to run FacesContext.getCurrentInstance().renderResponse() but not sure that's wise.

Thanks

From stackoverflow
  • One way is that the executing method in the managed bean [i.e on server side] which is in progress during your ajax call must be written in a way that it could be aborted so that it just returns thus ending the request.This would also maintain proper server side state.

    Mark Lewis : @scot thanks - so if I bind another method to the cancel which in the bean has power to interrupt the processing would that be the best way?
    daedlus : yes i think so.

0 comments:

Post a Comment