I am working with the application, which has JSF2 framework. The idea of that framework is to manage connection between Backend (Java) and Frontend.
I know, that JSF version we are using creates jsf.ajax object in a DOM, which holds several methods for performing passing and getting data.
And so, as I am building Frontend architecture based on modules pattern which has private scope each. Inside several modules I need to make AJAX call to get some data from Backend, but if I am using standart way of JSF by calling a4j:jsFunction (previously created), I am loosing the scope of my JavaScript module immediately. And, of course, can not return back to the module.
Therefore, I am asking is that possible to archive something similar to jQuery.ajax() method by using jsf.ajax object and its methods (request/reponse)?!
jQuery.ajax({
url: "", // I don't have url as in PHP, I have JSF action listener #{method.function}
data: { param: 'value' }, // params for method.function
success: function(data){
// yes I need to receive the data from Backend (maybe #{bean} or JSON)
}
});
I strongly believe, there's a way to use JSF and AJAX for Java (A4J) to archive my need by keeping a scope of JavaScript module, without going out of that when making AJAX calls.