title: <f:setPropertyActionListener /> : no update
body: <p>i have a problem with the <code>&lt;f:setPropertyActionListener /&gt;</code> property. Fields are not updated with the values saved in the target. when i debug i found that the target is initialised with the value but it doesnt work when i try to extract data in xhtm page.</p>
  
  <p>Here is the Code: </p>
  
  <p> 
      
  
  <blockquote>
  <pre><code>&lt;f:view&gt;
  &lt;h:head&gt;
  </code></pre>
  </blockquote>
  
  <pre><code>&lt;/h:head&gt;
  &lt;h:body&gt;
  
  &lt;h:form id="form" enctype="multipart/form-data"&gt;
  
    &lt;p:commandLink value="Ajouter" oncomplete="newcatDialog.show()" /&gt;  
  
  &lt;p:dataTable  value="#{categorieBean.categories}" var="categ"  id="table" &gt;
  &lt;f:facet name="header"&gt; 
    &lt;h:outputText value="Catégories" /&gt; 
  &lt;/f:facet&gt;
   &lt;p:column&gt;
   &lt;h:outputText id="id" value="#{categ.id}"/&gt;
   &lt;/p:column&gt;
   &lt;p:column&gt;
   &lt;h:outputText id="nom" value="#{categ.nom}"/&gt;
   &lt;/p:column&gt;
  
   &lt;p:column&gt;
      &lt;p:commandLink   update="display"  value="Modifier" onclick="catDialog.show()" &gt;  
         &lt;f:setPropertyActionListener  value="#{categ}"  
              target="#{categorieBean.selectedCategorie}" /&gt;
      &lt;/p:commandLink&gt;                       
   &lt;/p:column&gt;
  
  
  &lt;/p:dataTable&gt;
  
  
  
    &lt;p:dialog id="creation" header="Catégorie" widgetVar="newcatDialog" resizable="false" 
        autoSized="true" modal="true"&gt;
  
      &lt;h:panelGrid id="ceationDisplay" columns="2" cellpadding="4"&gt; 
       &lt;h:column&gt;&lt;h:outputText value="Nom: " /&gt;&lt;/h:column&gt;
             &lt;h:column&gt;
               &lt;h:inputText value="#{categorieBean.nom}" /&gt;
             &lt;/h:column&gt;
             &lt;h:column&gt;
               &lt;h:outputText value="Description: " /&gt;
             &lt;/h:column&gt;
             &lt;h:column&gt;
               &lt;h:inputText value="#{categorieBean.desc}" /&gt;
             &lt;/h:column&gt; 
             &lt;h:column&gt;
              &lt;h:outputText value="Photo: " /&gt;
             &lt;/h:column&gt;
             &lt;h:column&gt;
               &lt;p:fileUpload value="#{categorieBean.fichier}"  mode="simple" auto="true"
               allowTypes="/(\.|\/)(gif|jpe?g|png)$/" /&gt;  
  
             &lt;/h:column&gt;
             &lt;h:column&gt;
              &lt;p:commandButton value="Enregistrer"
                               actionListener="#{categorieBean.ajouter}" 
                               oncomplete="newcatDialog.hide()"
                               update="table"
                               ajax="false"
                               &gt;
  
              &lt;/p:commandButton&gt;
             &lt;/h:column&gt;
             &lt;h:column&gt;   
              &lt;p:commandButton value="Annuler" oncomplete="newcatDialog.hide()" &gt;&lt;/p:commandButton&gt;
             &lt;/h:column&gt; 
             &lt;/h:panelGrid&gt;
  
  
    &lt;/p:dialog&gt;   
  &lt;/h:form&gt;
  
  &lt;!-- ************************ --&gt;
  
    &lt;p:dialog id="modification" header="Catégorie" widgetVar="catDialog"  resizable="false" 
        autoSized="true" modal="true" appendToBody="true"&gt;
      &lt;h:form&gt;
      &lt;h:panelGrid id="display" columns="2" cellpadding="4"&gt; 
       &lt;h:column&gt;&lt;h:outputText value="Nom: " /&gt;&lt;/h:column&gt;
             &lt;h:column&gt;
               &lt;h:inputText value="#{categorieBean.selectedCategorie.nom}" /&gt;
             &lt;/h:column&gt;
             &lt;h:column&gt;
               &lt;h:outputText value="Description: " /&gt;
             &lt;/h:column&gt;
             &lt;h:column&gt;
               &lt;h:inputText value="#{categorieBean.selectedCategorie.desc}" /&gt;
             &lt;/h:column&gt; 
             &lt;h:column&gt;
              &lt;h:outputText value="Photo: " /&gt;
             &lt;/h:column&gt;
             &lt;h:column&gt;
               &lt;p:fileUpload value="#{categorieBean.fichiermodif}"  mode="simple" auto="true"
               allowTypes="/(\.|\/)(gif|jpe?g|png)$/" /&gt;  
  
             &lt;/h:column&gt;
             &lt;h:column&gt;
              &lt;p:commandButton value="Enregistrer"
                               actionListener="#{categorieBean.modifier}" 
                               oncomplete="catDialog.hide()"
                               update="table"
                               ajax="false"
                               &gt;
  
              &lt;/p:commandButton&gt;
             &lt;/h:column&gt;
             &lt;h:column&gt;   
              &lt;p:commandButton value="Annuler"     oncomplete="catDialog.hide()" &gt;&lt;/p:commandButton&gt;
             &lt;/h:column&gt; 
             &lt;/h:panelGrid&gt;
        &lt;/h:form&gt;
  
    &lt;/p:dialog&gt;
  
  &lt;/h:body&gt;
  &lt;/f:view&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and Here is the Backing Bean:</p>
  
  <pre><code>import java.io.File;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.List;
  import org.primefaces.model.UploadedFile;
  import tn.projet.model.Categorie;
  import tn.projet.service.CategorieService;
  import javax.annotation.PostConstruct;
  import javax.faces.context.FacesContext;
  import javax.servlet.ServletContext;
  
  
  
  
  public class CategorieBean implements Serializable{
  
  
  
  //DI via Spring
  
  private CategorieService categorieService;
  private List&lt;Categorie&gt; categories;
  private String nom;
  private String desc;
  private Categorie selectedCategorie;
  private String image;
  private UploadedFile fichier;
  private UploadedFile fichiermodif;
  
  
  @PostConstruct
  public void init()
      {
  
  
          this.categories = new ArrayList&lt;Categorie&gt;();
  
          categories=categorieService.listerCategorie();
  
      }
  
  /***********GETTERS/SETTERS**********/
  
  public UploadedFile getFichiermodif() {
      return fichiermodif;
  }
  
  public void setFichiermodif(UploadedFile fichiermodif) {
      this.fichiermodif = fichiermodif;
  }
  
  public UploadedFile getFichier() {
      return fichier;
  }
  
  public void setFichier(UploadedFile fichier) {
      this.fichier = fichier;
  }
  
  
  
  public CategorieBean() {
  
  }
  
  
  public String getDesc() {
      return desc;
  }
  
  public void setDesc(String desc) {
      this.desc = desc;
  }
  
  public String getNom() {
      return nom;
  }
  
  public void setNom(String nom) {
      this.nom = nom;
  }
  
  
      public CategorieService getCategorieService() {
      return categorieService;
  }
  
  
  public void setCategorieService(CategorieService categorieService) {
      this.categorieService = categorieService;
  }
  
  
  
  
  
  
  //recupérer la liste des catégories
  public List&lt;Categorie&gt; getCategories()
  {
  
  return categories;
  }
  
  
  public Categorie getSelectedCategorie() {
  
  
      return this.selectedCategorie;
      }
  
  
  
  public void setSelectedCategorie(Categorie select) {
      this.selectedCategorie =  select;
      }
  
  
  public String getImage() {
      return image;
  }
  
  public void setImage(String image) {
      this.image = image;
  }
  
  
  
  
  /**************CRUD***********************/
   //recupération du fichier image uploadé
  public String creerFichier(UploadedFile fich) throws Exception{
  
      ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
  
      String retour =fich.getFileName();
  
      String aux_f = servletContext.getRealPath("/")+retour;   
  
      File result = new File( aux_f); 
  
      try {
          FileOutputStream fileOutputStream = new FileOutputStream(result);
  
          byte[] buffer = new byte[6124];
  
          int bulk;
          InputStream inputStream = fich.getInputstream();
          while (true) {
              bulk = inputStream.read(buffer);
              if (bulk &lt; 0) {
                  break;
              }
              fileOutputStream.write(buffer, 0, bulk);
              fileOutputStream.flush();
          }
  
          fileOutputStream.close();
          inputStream.close();
  
  
  
  
      } catch (IOException e) {e.printStackTrace();}
  
      return retour;
  }
  
  
  
      public void modifier()
      {
          if(fichiermodif!=null)
          {
              try {
                  String imagemodif= creerFichier(fichiermodif);
                  selectedCategorie.setImage(imagemodif);
              } catch (Exception e) {e.printStackTrace();}
  
          }
  
          categorieService.modifierCategorie(selectedCategorie);
      }
      //add a new Categorie data into database
      public void ajouter(){
  
          if(fichiermodif!=null)
          {
              try {
                  image= creerFichier(fichier);
              } catch (Exception e) {e.printStackTrace();}
  
          }
  
  
          Categorie cat = new Categorie();
          cat.setNom(getNom());
          cat.setDesc(getDesc());
          cat.setImage(image);
          categorieService.ajouterCategorie(cat);
  
          }
  
  
    /******************actionListener****************/
      public void edit(){
  
          System.out.println("selectedCategorie.getNom()");
  
      }
  
  
  
  }
  </code></pre>