Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [faces-dev] Clarification Needed for Ajax CommandButton Events

Hi,

The behavior observed in 2.2.20 is correct. The action event should only be queued when the action event is fired (which is "click" in case of commandButton+ajax).

This was the original issue: https://github.com/eclipse-ee4j/mojarra/issues/3355https://github.com/eclipse-ee4j/mojarra/issues/3729
This was the PR which (unintentionally) changed the logic: https://github.com/javaee/mojarra/commit/4a8b275bb794433171d7a28b10a379b1149b67b4

Previously the code also checked RenderKitUtils#isPartialOrBehaviorAction in wasClicked() helper method and this needs to be brought back into the new if block.

Cheers, B

On Sun, Sep 1, 2024 at 4:51 PM Volodymyr Siedlecki via faces-dev <faces-dev@xxxxxxxxxxx> wrote:
Just following up.

MyFaces and Mojarra handle this scenario differently, and I would like consistent behavior.

For MyFaces, the behavior depends on whether MYFACES-4606 is applied. This MyFaces fix attaches the issuing element's ID to ajax requests,but the action event is queued if the client id is found in the request (which is standard for POST requests).

As for the spec, it doesn't mention ajax in the decode behavior: https://jakarta.ee/specifications/faces/3.0/vdldoc/html_basic/commandbutton (linked faces 3.0 but it hasn't changed from 2.2 - 4.1 as far as I could tell)

Mojarra has the following behaviors:

2.2.20:

  • Only the ajaxEventBean.listener() is triggered

2.3.21:

  • Both  ajaxEventBean.listener() and ajaxEventBean.confirm() are triggered
  • I'm curious under which issue this behavior changed?


    Appreciate any help! Thank you.

On Thu, Aug 29, 2024 at 12:23 PM Volodymyr Siedlecki <volosied@xxxxxxxxx> wrote:
Hello,

Given this code snippet:

<h:form>
...
<h:commandButton id="confirm2" value="listner2" action="">"#{ajaxEventBean.confirm()}" >
<f:ajax event="blur" listener="#{ajaxEventBean.listener()}"/>
</h:commandButton>
</h:form>


If the blur event is triggered, should the action and listener both be invoked for the XHR request? 
Or just the listener?

Thank you,

Volodymyr


_______________________________________________
faces-dev mailing list
faces-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/faces-dev

Back to the top