2 Replies Latest reply on Jun 8, 2007 3:23 AM by a.skokov

    a rich:datatable question

    alex_ph

      Hi,
      I have problems with the rich:datatable. I implement this tableBean with just the getTableMethod which directly used in the datatable.

      public Result getTable() {
       Statement st = null;
      
       try {
       // load driver and connect
       Class.forName( driver );
       Connection cn = DriverManager.getConnection( dbUrl, dbLogin, dbPW );
      
       st = cn.createStatement();
       String query = "SELECT * from " + getTableName();
      
       ResultSet resultSet = st.executeQuery(query);
       return(ResultSupport.toResult(resultSet));
       }
       catch(Exception e) { return(null); }
       }
      




      With h: datatable everything works fine:
      <h:dataTable styleClass="tableIFrame" value="#{tableBean.table}" var="dbRow">
       <h:column>
       <f:facet name="header">
       <h:outputText value="Game" />
       </f:facet>
       <h:outputText value="#{dbRow.game}"/>
       </h:column>
       </h:dataTable>



      But if I use rich:datatable:
      <rich:dataTable value="#{tableBean.table}" var="dbRow">
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column><h:outputText value="Game"/></rich:column>
       </rich:columnGroup>
       </f:facet>
       <rich:column>
       <h:outputText value="#{dbRow.game}"/>
       </rich:column>
       </rich:dataTable>



      I got this exception:

      javax.faces.el.PropertyNotFoundException: Error getting property 'game' from bean of type javax.servlet.jsp.jstl.sql.ResultImpl
      at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:107)


      Do I have to implement a game variable with setters/getters in the table-class? (h:datatable can use the Result from sql directly)

      Or am I blind and I do a mistake elsewhere?

      Thnx Alex