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

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



Back to the top