title: rich:dataScroller on custom RichLazyDataModel does not paginate
body: <p>I am trying to make pagination with JSF 2 and RichFaces 4.3.7. I look through example in richface4 about pagination in this link: <a href="http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=dataScroller&amp;sample=simpleScrolling&amp;skin=blueSky" rel="nofollow noreferrer">http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=dataScroller&amp;sample=simpleScrolling&amp;skin=blueSky</a></p>
  
  <p>and As You can see for <code>&lt;rich:dataScroller for="table" maxPages="5" fastStep="3"&gt;</code> it doesn't add any value I wonder How it control the database for Next page?
  I implement Class that Store data from database and I try To handle pagination But when I click on next page Nothing will happen I suppose I miss something in java Class and RichLazyDataModel class I found in one question in stackoverflow <a href="https://stackoverflow.com/questions/11937660/jsf-richfaces-pagination">JSF, RichFaces, pagination</a></p>
  
  <p>So RichLazyDataModelImpl extend that class 
  Any help Appreciate </p>
  
  <pre><code>public class RichLazyDataModelImpl extends RichLazyDataModel&lt;User&gt; {
  
      int firstRow = 0;
      int numRows = 5;
  
      @Override
      public List&lt;User&gt; getDataList(int firstRow, int numRows) {
          return getDataList() ;
      }
  
      public List&lt;User&gt; getDataList() {
          try {
              Connection conn =  DriverManager.getConnection(configure.myUrl, "root",
                      "pass");
              String sql = "select * from messages order by id_messages"; // limit ? offset ? ";
              PreparedStatement stmt = (PreparedStatement) conn.prepareStatement(sql);
              //stmt.setInt(2, new Integer(firstRow));
              //stmt.setInt(1, new Integer(numRows));
              ResultSet rs = stmt.executeQuery();
  
  
  
          List&lt;User&gt; result = new ArrayList&lt;User&gt;();
          while(rs.next()) {
              // read entry no. n
              User user = new User();
              String mobile =rs.getString("msg_msisdn");
              user.setMsg_mobile(mobile);
              String direction = rs.getString("msg_direction");
              user.setDirection(direction);
              String msg = rs.getString("msg_text");
              user.setMessage(msg);
              String status = rs.getString("msg_status");
              user.setMsg_status(status);
              Date time = rs.getDate("msg_time");
              user.setMsg_time((java.sql.Date) time);
              result.add(user);
              }
          return result;
      } catch (SQLException e) {
  
  
          e.printStackTrace();
      }
      return null;
  
      }
  
      @Override
      public Object getKey(User user) {
          // TODO Auto-generated method stub
          //return null;
          return user;
      }
  
      @Override
      public int getTotalCount() {
  
          String sql = " select count(*) as cnt from messages";
          PreparedStatement stmt;
          Integer result = 0;
          try {
              Connection conn =  DriverManager.getConnection(configure.myUrl, "pegah",
                      "pass");
              stmt = (PreparedStatement) conn.prepareStatement(sql);
              ResultSet rs = stmt.executeQuery();
              result = rs.getInt("cnt");
              rs.close();
              conn.close();
              System.out.println("The number of dataBase is "+result);
  
          } catch (SQLException e) {
  
              e.printStackTrace();
          }
  
          return result;
  
      }
  
      public void setCurrentPage(int page) {
          int row = (page-1) * numRows;
          firstRow = row;
      }
  
      public int getCurrentPage() {
          int page = firstRow / numRows;
          return page;
      }
  
  }
  </code></pre>
  
  <p>table.xhtml</p>
  
  <pre><code> &lt;rich:dataScroller id="sc2" for="table" maxPages="3" fastStep="3" &gt;
  
  &lt;/rich:dataScroller&gt;
   &lt;rich:dataTable value="#{RichLazyDataModelImpl.getDataList()}" var="cate" id="table" rows="5"&gt;
  
  
                  &lt;rich:column &gt;
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="Mobile " /&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="#{cate.getMsg_mobile()}" /&gt;
                  &lt;/rich:column&gt;
                    .
                    .
                    .
  </code></pre>