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

Werner Punz edited comment on MYFACES-4040 at 12/7/22 9:42 AM:
---------------------------------------------------------------

There was a bug in the myfaces js codebase.

Apparently anything which is not defined in the scope of the defined parameters 
(like render, execute, delay etc...)

was pushed in as request parameters. Thats the reason why the ab call and 
rendering was implemented this way.

This is a spec breach. The spec states that request parameters must be passed 
into faces.ajax.request under the key "params" under the options parameter. 

 
||name||value||
|{{execute}}|{{space seperated list of client identifiers}}|
|{{render}}|{{space seperated list of client identifiers}}|
|{{onevent}}|{{function to callback for event}}|
|{{onerror}}|{{function to callback for error}}|
|{{params}}|{{object containing parameters to include in the request}}|
|{{delay}}|If less than _delay_ milliseconds elapses between calls to 
_request()_ only the most recent one is sent and all other requests are 
discarded. If the value of _delay_ is the literal string {{'none'}} without the 
quotes, or no delay is specified, no delay is used.|
|{{resetValues}}|If true, ensure a post data argument with the name 
jakarta.faces.partial.resetValues and the value true is sent in addition to the 
other post data arguments. This will cause UIViewRoot.resetValues() to be 
called, passing the value of the "render" attribute. Note: do not use any of 
the @ keywords such as @form or @this with this option because 
UIViewRoot.resetValues() does not descend into the children of the listed 
components.|

I have fixed this recently in our codebase on the js side and now params are 
really what they are, however for now I left the old behavior intact to keep 
legacy code running (despite being clearly a spec "bending")

Also this was not ported yet to the existing legacy codebase, because when I 
fixed it I thought, this was not relevant anymore for the old codebase. But 
given the change of things, I will crossport the params handling as well into 
the old codebase.

(will raise a separate Jira issue for that)

But I can see where you are heading, you want to deal with f:params as option 
instead of parameter. But I would say the spec is here correct, since f:params 
always is used outside of ajax as extra parameters passed down and not as 
control parameter to achieve a certain behavior.

Either way on the faces.ajax codebase you can apply params (will check the old 
codebase wheter I have crossported the fix, but I remember I did)

So you can simply change the renderer accordingly on the f:ajax side and pass 
it in as params: {... just as the RI does. I will add the params handling to 
the old codebase as well (it already is active in the Typescript pull request)

 

 


was (Author: werpu):
There was a bug in the myfaces js codebase.

Apparently anything which is not defined in the scope of the defined parameters 
(like render, execute, delay etc...)

was pushed in as request parameters. Thats the reason why the ab call and 
rendering was implemented this way.

This is a spec breach. The spec states that request parameters must be passed 
into faces.ajax.request under the key "params" under the options parameter. 

 
||name||value||
|{{execute}}|{{space seperated list of client identifiers}}|
|{{render}}|{{space seperated list of client identifiers}}|
|{{onevent}}|{{function to callback for event}}|
|{{onerror}}|{{function to callback for error}}|
|{{params}}|{{object containing parameters to include in the request}}|
|{{delay}}|If less than _delay_ milliseconds elapses between calls to 
_request()_ only the most recent one is sent and all other requests are 
discarded. If the value of _delay_ is the literal string {{'none'}} without the 
quotes, or no delay is specified, no delay is used.|
|{{resetValues}}|If true, ensure a post data argument with the name 
jakarta.faces.partial.resetValues and the value true is sent in addition to the 
other post data arguments. This will cause UIViewRoot.resetValues() to be 
called, passing the value of the "render" attribute. Note: do not use any of 
the @ keywords such as @form or @this with this option because 
UIViewRoot.resetValues() does not descend into the children of the listed 
components.|

I have fixed this recently in our codebase on the js side and now params are 
really what they are, however for now I left the old behavior intact to keep 
legacy code running (despite being clearly a spec "bending")

Also this was not ported yet to the existing legacy codebase, because when I 
fixed it I thought, this was not relevant anymore for the old codebase. But 
given the change of things, I will crossport the params handling as well into 
the old codebase.

(will raise a separate Jira issue for that)

But I can see where you are heading, you want to deal with f:params as option 
instead of parameter. But I would say the spec is here correct, since f:params 
always is used outside of ajax as extra parameters passed down and not as 
control parameter to achieve a certain behavior.

Either way on the faces.ajax codebase you can apply params (will check the old 
codebase wheter I have crossported the fix, but I remember I did)

So you can simply change the renderer accordingly on the f:ajax side and pass 
it in as params: {... just as the RI does.

 

> <f:param> name conflicts with <f:ajax> attributes
> -------------------------------------------------
>
>                 Key: MYFACES-4040
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4040
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.2.9
>            Reporter: Bauke Scholtz
>            Assignee: Leonardo Uribe
>            Priority: Major
>         Attachments: test-faces23-ajax.war
>
>
> https://java.net/jira/browse/JAVASERVERFACES-4115 also applies to MyFaces.
> {code}
> <h:form>
>     <h:inputText id="foo" />
>     <h:commandLink value="test">
>         <f:ajax execute="foo" />
>         <f:param name="execute" value="bar" />
>     </h:commandLink>
> </h:form>
> {code}
> In MyFaces, the actual behavior is equal to <f:ajax execute="bar"> and 
> request.getParameter("execute") returns null.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to