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

Werner Punz commented on MYFACES-4710:
--------------------------------------

Ok I think I found the code which causes it: HtmlCommandScriptRenderer indeed 
seems to swallow the o parameter passed down:

 
{code:java}
// code placeholder
script.append("var "+name+" = function(o){var o=(typeof 
o==='object')&&o?o:{};");
script.prettyLine();

List<UIParameter> uiParams = HtmlRendererUtils.getValidUIParameterChildren(
        context, getChildren(commandScript), false, false);

StringBuilder ajax = SharedStringBuilder.get(context, AJAX_SB, 60);

AjaxScriptBuilder.build(context,
        ajax,
        commandScript,
        commandScript.getClientId(context),
        "action",
        commandScript.getExecute(),
        commandScript.getRender(),
        commandScript.getResetValues(),
        commandScript.getOnerror(),
        commandScript.getOnevent(),
        uiParams); 
script.append(ajax.toString());
script.decreaseIndent();
script.append("}");



{code}
the AjaxScriptBuilder ignores the o parameter, it probably must be passed into 
the ui params upfront to be taken into consideration. Also params should be 
passed via params: {} originally because the older specs did not specify it 
properly it was possible to pass them straight down. I got a bugreport a while 
ago in about a TCK failing because params was not taken into consideration, now 
in myfaces both methods work, but params should be used from now on as key for 
the params list!

I will look into it on fixing this but someone with more insight into the code 
probably can make a safer fix than I can!

 

> CommandScript: Behaves differently than Mojarra
> -----------------------------------------------
>
>                 Key: MYFACES-4710
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4710
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 4.0.2, 4.1.0
>            Reporter: Melloware
>            Assignee: Werner Punz
>            Priority: Major
>         Attachments: image-2025-02-03-11-04-43-114.png, 
> image-2025-02-03-11-04-58-475.png, image-2025-02-24-21-21-16-189.png, 
> image-2025-02-24-21-50-18-216.png, image-2025-02-24-21-51-24-014.png, 
> omnifaces-push-194.zip
>
>
> Original report: https://github.com/quarkiverse/quarkus-omnifaces/issues/194
> Basically if you pass a socket reponse message directly to a CommandScript 
> its supposed to convert those params to Request Parameters.
> {code:xml}
> <h:commandScript name="wsUpdate" action="#{omniPushBean.complex()}" 
> render="something"/>
> <o:socket channel='complex' onmessage="wsUpdate"/>
> {code}
> If the socket message was 
> {code:javascript}
> {"event":"test","id":"48e496b2-1aa7-42ec-bd57-0832c966d8c7"}
> {code}
> It the `wsUpdate` command is supposed to send those as Request parameters and 
> Mojarra does this but MyFaces does not.
> Mojarra:
>  !image-2025-02-03-11-04-43-114.png! 
> MyFaces:
>  !image-2025-02-03-11-04-58-475.png! 



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

Reply via email to