[
https://issues.apache.org/jira/browse/MYFACES-4680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17891650#comment-17891650
]
Werner Punz edited comment on MYFACES-4680 at 10/21/24 7:46 PM:
----------------------------------------------------------------
as I assumed following code fixes the example:
{code:xml}
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
....
<h:form id="form">
<h:commandButton id="button" value="push"
action="#{spec1396.send}"><f:ajax /></h:commandButton>
</h:form>
<div id="message"><h:outputText id="ajaxOutput"
value="#{spec1396.ajaxOutput}" p:form="form"/></div>
{code}
A html 5 form attribute is added to the render element (p:form="form")
Then the form can be determined, and the example passes, however, given that
there only is one form we can as I stated probably just pass that one
implicitly and then the example also should work! I think just in case of a
single form scenario this should be save, however in case of portlets we cannot
work that way and have to use the form passthrough, and multi form scenarii
were the reason why i added the form attribute support to begin with, to the
code!
(this is the html 5 way to allow form references outside of forms and allow
form elements outside of forms)
was (Author: werpu):
as I assumed following code fixes the example:
{code:xml}
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
....
<h:form id="form">
<h:commandButton id="button" value="push"
action="#{spec1396.send}"><f:ajax /></h:commandButton>
</h:form>
<div id="message"><h:outputText id="ajaxOutput"
value="#{spec1396.ajaxOutput}" p:form="form"/></div>
{code}
A html 5 form attribute is added to the render element (p:form="form")
Then the form can be determined, and the example passes, however, given that
there only is one form we can as I stated probably just pass that one
implicitly and then the example also should work!
> 4.1 TCK Failure: Spec1396IT#testViewScopedWebsocket
> ---------------------------------------------------
>
> Key: MYFACES-4680
> URL: https://issues.apache.org/jira/browse/MYFACES-4680
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 2.2.15, 2.3.10, 2.3-next-M8, 4.0.0, 4.1.0-RC2
> Reporter: Volodymyr Siedlecki
> Assignee: Volodymyr Siedlecki
> Priority: Major
> Attachments: image-2024-10-17-21-20-41-622.png,
> image-2024-10-17-21-21-22-229.png, screenshot-1.png, screenshot-2.png,
> test-faces23-websocket.war
>
>
> The app expects "pushed!" to display when the "push" button is pressed. It
> is not, and the test fails.
> Ajax requests do not occur when they are registered a websocket tag, from
> what I could gather. It seems like the renderAjaxOutput behavior isn't
> registered / called with the faces.push.init script.
> MyFaces generated code (see behavior param (1) – second to last):
> {code:java}
> faces.push.init('j_id_c','/test-faces23-websocket/jakarta.faces.push/view?76379b861759b95fa70c118d2e05d29f','view',function(){document.getElementById('opened').innerHTML='yes';},null,null,null,{renderAjaxOutput:[function(event){myfaces.ab('j_id_c',event,'renderAjaxOutput','','ajaxOutput')}]},true);{code}
> Facelet:
> [https://github.com/jakartaee/faces/blob/4.1.0-RELEASE/tck/faces23/websocket/src/main/webapp/spec1396ViewScopedWebsocket.xhtml#L39]
> {code:java}
> <f:websocket channel="view" scope="view"
> onopen="function(){document.getElementById('opened').innerHTML='yes';}">
> <f:ajax event="renderAjaxOutput" render="ajaxOutput" />
> </f:websocket>{code}
> Link to Test:
> [https://github.com/jakartaee/faces/blob/4.1.0-RELEASE/tck/faces23/websocket/src/test/java/ee/jakarta/tck/faces/test/javaee8/websocket/Spec1396IT.java#L94]
> I test the same TCK app on Mojarra, and it sends out two XHR requests when
> the button is clicked. One for the button click and another for the
> renderAjaxOutput event.
> MyFaces only handles the one XHR for the button click. Neither do I see the
> onMessage invoked, which per the javadoc should trigger the behavior (
> "behavior param: Client behavior functions to be invoked when specific
> message is received.")?
> Docs:
> [1)
> https://jakarta.ee/specifications/faces/4.0/jsdoc/faces.push|https://jakarta.ee/specifications/faces/4.0/jsdoc/faces.push]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)