jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: Re: [jsr372-experts mirror] Re: [JSF spec issues] [JIRA] (JAVASERVERFACES_SPEC_PUBLIC-907) Improve Ajax Http.Get support to (re)render parts of the page

From: Frank Caputo <frank_at_frankcaputo.de>
Date: Mon, 14 Sep 2015 10:38:30 +0200

Hi,

here we go. I’ve done it with jQuery, because it’s really hard to change things in the jsf-javascript-library. I implemented jsf.ajax.get and jsf.ajax.render. Render simply uses get. I implemented get for simple navigation. The key is to handle the responses with jsf.ajax.response.
jsf.ajax.get = function(userSettings) {
    var settings = $.extend({
        url:window.location.href,
        headers:{
            'Faces-Request':'partial/ajax'
        },
        cache:false,
        error:function (data, textStatus, jqXHR) {
            jsf.ajax.response(jqXHR, {formid:'none'});
        },
        beforeSend: function () {
            // show a loader or whatever you want
        },
        success: function (data, textStatus, jqXHR) {
            jsf.ajax.response(jqXHR, {formid:'none'});
        }
    }, userSettings);
    $.ajax(settings);
};

jsf.ajax.render = function(ids, data) {
    data = data || {};
    data['javax.faces.partial.render'] = ids;
    data['javax.faces.partial.ajax'] = true;
    jsf.ajax.get('', {
        type: 'POST',
        data: data
    });
};
Hope this is understandable.

Ciao Frank

> Am 11.09.2015 um 22:21 schrieb Edward Burns <edward.burns_at_oracle.com>:
>
>>>>>> On Fri, 11 Sep 2015 10:11:44 -0500, Josh Juneau <juneau001_at_gmail.com> said:
>
> JJ> +1, I'd also be interested in seeing your implementation. Thanks
>
> Me too.
>
> --
> | edward.burns_at_oracle.com | office: +1 407 458 0017
> | 39 Business days til JavaOne 2015
> | 54 Business days til DOAG 2015