title: Exception thrown while accessing HTML DataTable in backing bean
body: <p>I am building a simple application in JSF with the CrUD functionality. I am trying to implement edit functionality using the tomahawk component .I am unable to retrieve the <em>selected</em> row in my backing bean.</p>
  
  <p>Here's my JSP file snip:</p>
  
  <pre><code>       &lt;t:dataTable id="data"
            binding="#{selectOneRowList.dataTable}"
              styleClass="scrollerTable"
              headerClass="standardTable_Header"
              footerClass="standardTable_Header"
              rowClasses="standardTable_Row1,standardTable_Row2"
              columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
              var="car"
              value="#{selectOneRowList.list}"
              sortColumn="#{selectOneRowList.sortColumn}"
              sortAscending="#{selectOneRowList.sortAscending}"
              preserveDataModel="false"
              preserveSort="true"
              preserveRowStates="true"
              rows="10"
         &gt;
         &lt;h:column&gt;
             &lt;f:facet name="header"&gt;
                 &lt;h:outputText value="Select"/&gt;
             &lt;/f:facet&gt;
             &lt;t:selectOneRow  groupName="selection" id="hugo" value="#{selectOneRowList.selectedRowIndex}"
                     onchange="submit();" immediate="true"
                     valueChangeListener="#{selectOneRowList.processRowSelection}"/&gt;
         &lt;/h:column&gt;
  
         &lt;h:column&gt;
             &lt;f:facet name="header"&gt;
             &lt;/f:facet&gt;
             &lt;h:outputText value="#{car.id}" /&gt;
         &lt;/h:column&gt;
  
         &lt;h:column&gt;
             &lt;f:facet name="header"&gt;
                &lt;h:outputText value="Cars" /&gt;
             &lt;/f:facet&gt;
             &lt;h:outputText value="#{car.type}" /&gt;
         &lt;/h:column&gt;
  
         &lt;t:column sortable="true"&gt;
             &lt;f:facet name="header"&gt;
                &lt;h:outputText value="Color" /&gt;
              &lt;/f:facet&gt;
             &lt;h:outputText value="#{car.color}" /&gt;
         &lt;/t:column&gt;
  
      &lt;/t:dataTable&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here's my backing bean SelectOneRowList.java :</p>
  
  <pre><code>     public void editCar(ActionEvent event) {
      System.out.println("Row number ## " + _selectedRowIndex.toString() + " selected!");
      System.out.println("Datatable ::"+ dataTable);              
      System.out.println("Row Count ::" + dataTable.getRowCount());
      dataItem = (SimpleCar) getDataTable().getRowData();
  
      //selectedCar = (SimpleCar)  _list.get(Integer.parseInt(_selectedRowIndex.toString()));
      selectedCar = (SimpleCar) dataTable.getRowData();
  
      System.out.println(dataTable.getRowData());
  }
  </code></pre>
  
  <p>My DTO{Data Transfer Object} which is SimpleCar.java contains the variables ID, type, color and their respective setters/getters.</p>
  
  <p>The <em>dataItem</em> variable is of type "SimpleCar". The <em>dataTable</em> is of type HTMLDataTable. I am able to get the the first 3 SOP's but the 4th SOP isn't printed. I receive the following exception on the server :</p>
  
  <blockquote>
    <p>javax.faces.el.EvaluationException: Exception while invoking expression #{selectOneRowList.editCar}
        org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
        javax.faces.component.UICommand.broadcast(UICommand.java:89)
        javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
        javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
        org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
        org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
        org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
        javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
        org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341)</p>
  </blockquote>
  
  <p>On click of the edit button the editCar method in my backing bean is invoked. I need to get the data of the selected row in my backing bean. Why is the exception occurring ?</p>
  
  <p>The above example is taken from the tomawhawk examples WAR distributed on the website. I have gone through many links including the ones on <a href="http://balusc.blogspot.com/2006/06/using-datatables.html" rel="nofollow noreferrer">BalusC</a> but none of them have helped. </p>
  
  <p>Regards,</p>