title: Binding primefaces dataTable with org.primefaces.component.datatable.DataTable;
body: <p>I have a question regarding primefaces datatable component. I want to bind a DataTable variable to the p:dataTable so that I would be able to manipulate the first, rows, rowsPerPageTemplate, etc. programmatically from the backing bean. But I'm stuck and keep getting java.lang.String cannot be cast to javax.faces.component.UIComponent.</p>
  
  <p>Here's my p:dataTable declaration.</p>
  
  <pre><code>&lt;p:dataTable id="dtProductCategoryList" value="#{saProductCategoryController.saproductcategories}" rowsPerPageTemplate="#{appConfig.rowsPerPageTemplate}" 
                               paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}" 
                               currentPageReportTemplate="{currentPage} #{bundle.DataTablePageSeparator} {totalPages}"
                               paginatorAlwaysVisible="false" var="item" paginator="true" rows="#{appConfig.rowsPerPageDefault}"
                               binding="saProductCategoryController.dtProductCategory"&gt;
  </code></pre>
  
  <p>And here's my ViewScoped backing bean. </p>
  
  <pre><code>    private DataTable dtProductCategory;
  
  /** Creates a new instance of saProductCategoryController */
  public SaProductCategoryController() {
  }
  
  @PostConstruct
  public void Init() {
      try {
          dtProductCategory = new DataTable();
          //dtProductCategory.
          saproductcategories = saProductCategoryFacade.selectAll();            
          LogController.log.info("Creating postconstruct for saProductCategoryController");
      } catch (Exception ex) {
          LogController.log.fatal(ex.toString());
      }
  }
  </code></pre>
  
  <p>What could be the problem? It seems that the DataTable variable is mistaken for a String?</p>
  
  <p>Appreciate all your help. Thanks.</p>