is it possible to provide pagination in h:datatable

is it possible to provide pagination in h:datatable in JSF

when i click next button it would go to next record

if possible how could i do that
LVL 9
Manikandan ThiagarajanSenior consultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Manikandan ThiagarajanSenior consultantAuthor Commented:
package com.citi.cpb.cws.workwithclient.vo;
import javax.faces.*;

public class TableBean {

      private perInfo[] perInfoAll = new perInfo[]{
      new perInfo("Chandler Richard Relationship Accounts", "P1Test01u", "NewYorkUS", "Manjil,Aisha", "AM005468980"),
      new perInfo("Chandler Richard Relationship Accounts", "P1Test01u", "NewYorkUS", "Manjil,Aisha", "AM005468980"),
      
      };

      public perInfo[] getperInfoAll() {
      return perInfoAll;
      }
      public String selectUserId() {
            return "success";
            }
       public void pageFirst() {
              dataTable.setFirst(0);
          }

          public void pagePrevious() {
              dataTable.setFirst(dataTable.getFirst() - dataTable.getRows());
          }

          public void pageNext() {
              dataTable.setFirst(dataTable.getFirst() + dataTable.getRows());
          }

          public void pageLast() {
              int count = dataTable.getRowCount();
              int rows = dataTable.getRows();
              dataTable.setFirst(count - ((count % rows != 0) ? count % rows : rows));
          }

      public class perInfo {
      String name;
      String userId;
      String PRC;
      String bankerName;
      String careId;

      public perInfo(String name, String userId, String PRC, String bankerName, String careId) {
      this.userId = userId;
      this.name = name;
      this.bankerName = bankerName;
      this.PRC = PRC;
      this.careId= careId;
      }

      public String getName() {
            return name;
      }

      public void setName(String name) {
            this.name = name;
      }

      public String getUserId() {
            return userId;
      }

      public void setUserId(String userId) {
            this.userId = userId;
      }

      public String getPRC() {
            return PRC;
      }

      public void setPRC(String prc) {
            PRC = prc;
      }

      public String getBankerName() {
            return bankerName;
      }

      public void setBankerName(String bankerName) {
            this.bankerName = bankerName;
      }

      public String getCareId() {
            return careId;
      }

      public void setCareId(String careId) {
            this.careId = careId;
      }

      
      }

      }

how could i use the datatable

in that porgarm it would show the error in datatable
0
a_bCommented:
What is the error that you see?
0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Manikandan ThiagarajanSenior consultantAuthor Commented:
dataTable can not be resolved

i need to import any package for that
0
a_bCommented:
You need to have the jsf jar on the classpath
0
Sathish David Kumar NArchitectCommented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.