title: Dynamically updated commandLink not working JSF
body: <p>I'm trying to use a h:commandLink which is dynamically added to each row of a table. When the link &quot;view details&quot; is clicked, the user should be redirected to the page &quot;View.xhtml&quot; where the user will be able to see additional details. However, what's happening is that when the link is clicked it seems to be just refreshing the page and removing the previous list results. I've read around quite a bit and tried a bunch of different things to no avail.</p>
  <p>Additionally, the link works perfectly fine when hardcoded and placed outside of the table.</p>
  <p>List.xhtml:</p>
  <pre><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
          &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
  &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
        xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
        xmlns:f=&quot;http://java.sun.com/jsf/core&quot;
        xmlns:fn=&quot;http://java.sun.com/jsp/jstl/functions&quot;&gt;
  &lt;h:head&gt;
      &lt;title&gt;List of Properties For Rent&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;h1&gt;List of Properties For Rent&lt;/h1&gt;
      &lt;hr/&gt;
      &lt;h:dataTable value=&quot;#{propertiesForRentController.propertiesForRentList}&quot; var=&quot;RL&quot; border=&quot;1&quot;&gt;
          &lt;h:column&gt;
              &lt;f:facet name=&quot;header&quot;&gt;
                  &lt;h:outputText value=&quot;ID&quot;/&gt;
              &lt;/f:facet&gt;
              &lt;h:outputText value=&quot;#{RL.id}&quot;/&gt;
          &lt;/h:column&gt;
  
          &lt;h:column&gt;
              &lt;f:facet name=&quot;header&quot;&gt;
                  &lt;h:outputText value=&quot;Type&quot;/&gt;
              &lt;/f:facet&gt;
              &lt;h:outputText value=&quot;#{RL.propertyType}&quot;/&gt;
          &lt;/h:column&gt;
  
          &lt;h:column&gt;
              &lt;f:facet name=&quot;header&quot;&gt;
                  &lt;h:outputText value=&quot;Location&quot;/&gt;
              &lt;/f:facet&gt;
              &lt;h:outputText value=&quot;#{RL.address}&quot;/&gt;
          &lt;/h:column&gt;
          
          &lt;h:column&gt;
              &lt;f:facet name=&quot;header&quot;&gt;
                  &lt;h:outputText value=&quot;Action&quot;/&gt;
              &lt;/f:facet&gt;
              &lt;h:form&gt;
                  &lt;h:commandLink action=&quot;#{propertiesForRentController.showDetailsPropertiesForRent(RL)}&quot; value=&quot;View Details&quot; /&gt;
              &lt;/h:form&gt;
          &lt;/h:column&gt;     
      &lt;/h:dataTable&gt;
      
      &lt;p&gt;Total Properties For Rent: #{fn:length(propertiesForRentController.propertiesForRentList)}&lt;/p&gt;
      
      &lt;hr/&gt;
      &lt;a href=&quot;index.xhtml&quot;&gt;Main page&lt;/a&gt; | 
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>PropertiesForRentController:</p>
  <pre><code>package Default;
  
  import java.io.Serializable;
  import java.util.*;
  import javax.inject.Named;
  import javax.ejb.EJB;
  import javax.enterprise.context.RequestScoped;
  import javax.enterprise.context.SessionScoped;
  import javax.faces.bean.ManagedBean;
  
  @ManagedBean
  @Named(value = &quot;propertiesForRentController&quot;)
  @SessionScoped
  public class PropertiesForRentController implements Serializable
  {
  
      @EJB
      private PropertiesForRentEJB propertiesForRentEJB;
      private PropertiesForRent propertiesForRentSelected = new PropertiesForRent();
      private PropertiesForRent propertiesForRent = new PropertiesForRent();
      private PropertiesForRent propertiesForRent2 = new PropertiesForRent();
      private List&lt;PropertiesForRent&gt; propertiesForRentList = new ArrayList&lt;PropertiesForRent&gt;();
      
      public String showDetailsPropertiesForRent(PropertiesForRent propertiesForRent) 
      {
          this.propertiesForRent2 = propertiesForRent;
          return &quot;/propertiesForRent/View.xhtml&quot;;
      }
      
      public String doCreatePropertiesForRent() 
      {
          propertiesForRent = propertiesForRentEJB.createPropertyForRent(propertiesForRent);
          propertiesForRentList = propertiesForRentEJB.findPropertiesForRent();
          return &quot;/propertiesForRent/List.xhtml&quot;;
      } 
      
      public String doListPropertiesForRent() 
      {
          propertiesForRentList = propertiesForRentEJB.findPropertiesForRent();
          return &quot;/propertiesForRent/List.xhtml&quot;;
      }
      
      public String doDeletePropertiesForRent(Long ID)
      {
          this.propertiesForRentSelected = propertiesForRentEJB.findPropertiesForRentByID(ID);
          propertiesForRentEJB.deletePropertiesForRentByID(ID);
          return &quot;/propertiesForRent/List.xhtml&quot;;
      }
  
      public PropertiesForRent getPropertiesForRent()
      {
          return propertiesForRent;
      }
  
      public void setPropertiesForRent(PropertiesForRent propertiesForRent)
      {
          this.propertiesForRent = propertiesForRent;
      }
  
      public List&lt;PropertiesForRent&gt; getPropertiesForRentList()
      {
          return propertiesForRentList;
      }
  
      public void setPropertiesForRentList(List&lt;PropertiesForRent&gt; propertiesForRentList)
      {
          this.propertiesForRentList = propertiesForRentList;
      }
  }
  </code></pre>