I need to get JSONP data from the QueryBuilder servlet , i.e, json data that it returns wrapped in the callback function, because I need to make this request cross domain. How can this be done?
You can write your own servlet for running query builder queries and returning JSONP. The query builder has a simple API  that is made for reading the parameters from a HTTP request. See the first sample in the javadoc. or have a look at slides 16 ff from this presentation .
Europe, Middle East and Africa