2 Replies Latest reply on Jul 11, 2011 12:37 PM by newbie0014

    f:setPropertyActionListener is not working

    newbie0014

      Hi,

       

      I am using rich:datatable.

      For editing datatable , i used following codeline

       

      <a4j:commandLink
         
      styleClass="no-decor"
         
      reRender="machineDisplayTable"
         
      value="edit"
         
      oncomplete="#{rich:component('editMyMachinePanel')}.show()">
         
      <f:setPropertyActionListener
             
      target="#{machineTable.myMachineToEdit}"
             
      value="#{Machine}"/>
      </a4j:commandLink>

       

       

      where "machineDisplayTable" is id for datatable, "editMyMachinePanel" is rich:modalpanel, "machineTable" is bean class and "myMachineToEdit" is class of type machine.

       

      In rich:modalpanel, i am printing Machine hostname.

       

      <rich:modalPanel id="editMyMachinePanel" autosized="true">
         
      <f:facet name="header">
             
      <h:outputText value="#{machineTable.myMachineToEdit.hostname}" />
         
      </f:facet>
         
      <a4j:commandButton value="Cancel" onclick="# {rich:component('editMyMachinePanel')}.hide(); return false;" />
      </rich:modalPanel>

       

      The Above piece of code are supposed to set first bean attribute (myMachineToEdit) and then render rich:modalpanel(editMyMachinePanel).

       

      But it seems just opposite is happening. Firstly it is rendering panel and then setting the values, because of which i am not getting anything in panel which is supposed to have machine hostname.

       

      I refered two site for this :

       

      http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=dataTable&sample=dataTableEdit&skin=blueSky

      and

      http://binamebou.be/phoenix-framework/wiki/index.php5?title=Richfaces_FAQ

       

       

      Second link has explained the problem as:

      "Since Richfaces 3.3.0 the f:setPropertyActionListener tag invokes the variable setter after invoking actionListener. Due to this modification the code placed into the actionListener event is invoked before arguments are set and generate null pointer exceptions or bad variable assignment (old value still present into arg variable)."

       

      Please tell me way to resolve the issue.