2 Replies Latest reply on Jun 8, 2007 3:23 AM by Alex Skokov

    a rich:datatable question

    Alex Newbie

      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);
       catch(Exception e) { return(null); }

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

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

      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