title: How can I navigate to a different page when user clicks a row?
body: <p>I want to be able to navigate to a different page when user clicks are row.<br>
  <strong><em>Problems</em></strong><br></p>
  
  <ul>
  <li>No error is thrown I can see the <code>selectionListener</code> getting executed with expected row value but nothing happens.</li>
  <li>Is this the right way of doing it i.e. using my action listener for this purpose.</li>
  </ul>
  
  <p>Backing bean is this.<br >
  <strong>Backing bean</strong> </p>
  
  <pre><code>package com.howto;
  
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.List;
  
  import javax.annotation.PostConstruct;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  import javax.faces.event.AjaxBehaviorEvent;
  import javax.faces.model.DataModel;
  
  import org.richfaces.component.UIExtendedDataTable;
  
  @ManagedBean(name = "backingBean")
  @SessionScoped
  public class BackingBean {
      private List&lt;String&gt; names;
      private DataModel&lt;String&gt; name;
      private String rowValue;
     // private List&lt;String&gt; selection;
      private Collection&lt;String&gt; selection;
  
      @PostConstruct
      public void init() {
          names = new ArrayList&lt;String&gt;();
          names.add("MyName");
          names.add("YourName");
          names.add("OurName");
          names.add("MamaDidNotGiveOne");
      }
  
      public void update() {
          System.out.println("Somebody clicked "
                  + name);
      }
  
      public List&lt;String&gt; getNames() {
          return names;
      }
  
      public void setNames(List&lt;String&gt; names) {
          this.names = names;
      }
  
      public DataModel&lt;String&gt; getName() {
          return name;
      }
  
      public void setName(DataModel&lt;String&gt; name) {
          this.name = name;
      }
  
      public String selectionListener(AjaxBehaviorEvent event) {
          UIExtendedDataTable dataTable = (UIExtendedDataTable) event.getComponent();
          Object originalKey = dataTable.getRowKey();
        //  selectionItems.clear();
          for (Object selectionKey : selection) {
              dataTable.setRowKey(selectionKey);
              if (dataTable.isRowAvailable()) {
                  //selectionItems.add((InventoryItem) dataTable.getRowData());
                  rowValue =  (String) dataTable.getRowData();
              }
          }        
          dataTable.setRowKey(originalKey);
          return "success";
      }
  
      public String gotopage() {
          return "success";
      }
  
      public Collection&lt;String&gt; getSelection() {
          return selection;
      }
  
      public void setSelection(Collection&lt;String&gt; selection) {
          this.selection = selection;
      }
  
      public String getRowValue() {
          return rowValue;
      }
  
      public void setRowValue(String rowValue) {
          this.rowValue = rowValue;
      }
  
  }
  </code></pre>
  
  <p>Method <code>selectionListener</code>does get hit every time user clicks a row item no error is thrown but nothing happens.<br>
  <strong>XHTML</strong></p>
  
  <pre><code>        &lt;h:form&gt;
              &lt;rich:extendedDataTable
                  value="#{backingBean.names}" var="rowItem"
                  selection="#{backingBean.selection}" id="table"
                  frozenColumns="2" style="height:300px; width:500px;" selectionMode="single"&gt;
                  &lt;a4j:ajax event="selectionchange" listener="#{backingBean.selectionListener}" /&gt;                    
                  &lt;rich:column&gt;
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="vendor" /&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="#{rowItem}" /&gt;
                  &lt;/rich:column&gt;
              &lt;/rich:extendedDataTable&gt;
          &lt;/h:form&gt;
  </code></pre>
  
  <p><strong>Navigation Rule<br></strong></p>
  
  <pre><code>&lt;navigation-rule&gt;
          &lt;from-view-id&gt;*&lt;/from-view-id&gt;
           &lt;navigation-case&gt;
              &lt;from-action&gt;#{backingBean.selectionListener}&lt;/from-action&gt;
              &lt;from-outcome&gt;success&lt;/from-outcome&gt;
              &lt;to-view-id&gt;/pages/dummyfolder/results.xhtml&lt;/to-view-id&gt;
          &lt;/navigation-case&gt;
  &lt;/navigation-rule&gt;
  </code></pre>
  
  <hr>
  
  <p><em>Using <strong>Richfaces 4</strong> could not find a tag with version.</em></p>