You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Michael Freedman (JIRA)" <de...@myfaces.apache.org> on 2011/02/24 21:37:38 UTC

[jira] Commented: (MYFACES-3045) jsf.js jsf.ajax.request doesn't resolve calling URL correctly -- ajax use in portlets broken

    [ https://issues.apache.org/jira/browse/MYFACES-3045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12999028#comment-12999028 ] 

Michael Freedman commented on MYFACES-3045:
-------------------------------------------

A potential patch (this works for me): replace the line in _AjaxRequest._startXHR:
        this._xhr.open(this._ajaxType, this._sourceForm.action+
                ((this._ajaxType == "GET")? "?"+this._requestParameters.makeFinal():"")
                , true);

with the following lines:


        var targetURL;
        if (typeof this._sourceForm.elements["javax.faces.encodedURL"] == 'undefined') {
              targetURL = this._sourceForm.action;
        } else {
              targetURL = this._sourceForm.elements["javax.faces.encodedURL"].value;
	  }

        this._xhr.open(this._ajaxType, targetURL +
                ((this._ajaxType == "GET")? "?"+this._requestParameters.makeFinal():"")
                , true);

Sorry no patch file as the one that the Diff program used to generate the patch seems to want to replace everything...And anyway I am not authorized to provide includable patches.


> jsf.js jsf.ajax.request doesn't resolve calling URL correctly -- ajax use in portlets broken
> --------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3045
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3045
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.5-SNAPSHOT
>            Reporter: Michael Freedman
>
> Javadoc for jsf.ajax.request says you determine the calling URL by:
> Determine the posting URL as follows: If the hidden field javax.faces.encodedURL is present in the submitting form, use its value as the posting URL. Otherwise, use the action property of the form element as the URL.
> Looks like the MyFaces impl skips loking for/using the javax.faces.encodedURL and only uses the form action.  This means ajax is broken in portlets (when using MyFaces).  I.e. the  javax.faces.encodedURL in the portlet case is different than the action URL and the one that needs to be used.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira