It looks like i'm not familiar with JSF as much as I've thought. What is the expected behavior in JSF 1.2 + Facelets for f:setPropertyActionListener?

code:

<h:panelGroup rendered="#{PersonMB.person == null}">
 <h:dataTable value="#{PersonMB.allPersons}" var="item" >
   <h:column>
     <f:facet name="header">Name</f:facet>
     #{item.name}
</h:column> <h:column>
     <h:commandLink value="Edit" actionListener="#{PersonMB.edit}" >
<f:setPropertyActionListener value="#{item}" target="#{PersonMB.person}" />
     </h:commandLink>
   </h:column>
   <h:column>
     <h:commandLink actionListener="#{PersonMB.delete}" value="Delete" >
<f:setPropertyActionListener value="#{item}" target="#{PersonMB.person}" />
     </h:commandLink>
   </h:column>
 </h:dataTable>
<h:commandLink onclick="dialog.show()" actionListener="#{PersonMB.createPerson}" value="New person" />
 <br />
 <h:commandLink actionListener="#{PersonMB.reload}" value="Reload" />
</h:panelGroup>

PersonMB:
    @EJB
    PersonController controller;

    private Person person;

    public Person getPerson(){
      return person;
    }
public void setPerson(Person _person){
      this.person=_person;
    }

   public void delete(ActionEvent event){
      controller.delete(person);
   }

So here are two possible scenarios:
case #1: actionListener "delete" executes BEFORE f:setPropertyActionListener sets value "item" to "person" case #2: actionListener "delete" executes AFTER f:setPropertyActionListener sets value "item" to "person"

....

In case #1 action listener "delete" isn't executed as expected because "person" is null, but in case #2 function is executed properly.

Why I'm asking this?
Till facelets version 1.1.14+trinidad and back on old Oracle ADF Faces all my applications behaved as described in scenario case #2, BUT with trinidad+facelets 1.1.14 or IceFaces 1.8.x and now JSF 2.0 (mojarra) behavior changed to scenario case #1.

What is the proper behavior according to specification ?

Best regards,

Luka Surija


Reply via email to