Yeah, it works. Thank you.

I'm just wondering the behavior is changed between facelets 1.1.13 and 1.1.14?

Luka Surija


Jakob Korherr wrote:
Hi Luka,

The JSF 2.0 specification only explains that when attaching a
<f:setPropertyActionListener>, an ActionListener (with specific behavior)
should be created and added to the nesting UIComponent (which has to
implement ActionSource) with addActionListener().

From my point of view it is not clear which is added first, the action
listener from the tag attribute »actionListener« or the nested action
listener(s), but I think the order is: first tag attributes, then nested
tags.

You can try to work around this problem using <f:actionListener /> below
<f:setPropertyActionListener> instead of the tag attribute »actionListener«,
so that it will be added to the UIComponent after
<f:setPropertyActionListener> and thus executed after
<f:setPropertyActionListener>.

I hope this works for you.

Regards,

Jakob Korherr


2009/12/16 Luka Surija <[email protected]>

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