JSF f: event execution order

Suppose I have several f: event tags for handling the same event:

<f:event type="preRenderView" listener="#{myBean.action1()} /> <f:event type="preRenderView" listener="#{myBean.action2()} /> 

Is the execution order guaranteed?

Edit:
To clarify why I need them to be executed in a specific order, here is my use case:

myBean # action1 is actually a setter

myBean # action2 is a method that works in the field specified by action1

In my opinion, the order is unreliable, so I just put them as EL expressions inside my layout like:

 <p:ouputPanel> #{myBean.action1()} #{myBean.action2()} </p:ouputPanel> 
+4
source share
1 answer

spec doesn't seem to indicate explicitly anywhere.

Application#publishEvent() API mentions that they are received and processed as a List , which is inherently ordered. Both versions of Mojarra and MyFaces confirm this by storing them in CopyOnWriteArrayList and ArrayList respectively.

Thus, logically based on the API and both implementations, they are indeed executed in order if they are added to the same component of the parent interface.

+4
source

All Articles