1 Reply Latest reply on Jul 17, 2008 4:55 PM by Pawel Wrzeszcz

    How to Iterate ArrayList Data in Datatable

    Muruga boopathy Newbie
      Hi,
        I tried iterating a arraylist to display it in rich datatable, but getting the whole arraylist like this [a1,a3,a4] ,Here is my code which is used . Please suggest .

      Java Bean

      public class LiablitiesList implements Serializable {

                     
                      private ArrayList liabList;
                      private String autoLoan = "Auto Loan";
                      private String personalLoan = "Personal Loan";
                      private String homeLoan = "Home Loan";
                      private String overDraft = "Overdraft";
                      private String others = "Others";
                     
                      private int size;
                     
                     
                      public LiablitiesList(){
                              liabList = new ArrayList();
                              liabList.add(autoLoan);
                              liabList.add(personalLoan);
                              liabList.add(homeLoan);
                              liabList.add(overDraft);
                              liabList.add(others);
                              this.setLiabList(liabList);
                              this.setSize(liabList.size());
                      }


                      /**
                       * @return the liabList
                       */
                      public ArrayList getLiabList() {
                              return liabList;
                      }


                      /**
                       * @param liabList the liabList to set
                       */
                      private void setLiabList(ArrayList liabList) {
                              this.liabList = liabList;
                      }


                      /**
                       * @return the size
                       */
                      public int getSize() {
                              return size;
                      }


                      /**
                       * @param size the size to set
                       */
                      public void setSize(int size) {
                              this.size = size;
                      }      
      }

      Faclets :

      <rich:dataTable
                          cellpadding="0" cellspacing="0"
                          width="700" border="0" var="liabList" value="#{liablities.liabList}">
                          <rich:column>
                              <f:facet name="header">
                                  <h:outputText value="Facilities"/>
                              </f:facet>
                              <h:outputText value="#{item.liabList}"/>
                          </rich:column>
      </rich:dataTable>