Link to home
Start Free TrialLog in
Avatar of Manikandan Thiagarajan
Manikandan ThiagarajanFlag for India

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of a_b
a_b

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Manikandan Thiagarajan

ASKER

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
Avatar of a_b
a_b

What is the error that you see?
dataTable can not be resolved

i need to import any package for that
You need to have the jsf jar on the classpath