2013-10-16 66 views
0

我急需在jsf中用以下動態字符串數據創建一個dataTable。我儘可能地去了,我非常需要幫助。我想要做的就是循環查看數據以顯示在我的dataTable上。如何在DataTable中顯示列表

以下是多遠我來

enter code here 
import java.util.ArrayList; 
import java.util.Arrays; 
import java.util.Collections; 
import java.util.Iterator; 
import java.util.List; 

/** 
* 
* @author mySelf 
*/ 
public class One { 

    static String s = "1701|001271651913|e13f7108-6f7c-4ea5-b77f-f016259a574e, " 
      + "1701|001207488366|2ee40509-af86-4470-84c8-0d2aec494367"; 

    public static List<String> myGuava() { 
     List<String> ss = new ArrayList<>(Arrays.asList(s.split(","))); 
     List<String> oldList = new ArrayList<>(ss); 

     Iterator<String> iterator = oldList.iterator(); 

     List myList = new ArrayList(); 
     while (iterator.hasNext()) { 
      ArrayList as = new ArrayList(); 
      as.add(iterator.next().replace("|", ",").trim()); 
      Collections.addAll(myList, as); 
     } 
     return myList; 
    } 

    public static void main(String[] args) { 
     List<String> myGuava = One.myGuava(); 

     System.out.println(myGuava); 
    } 
} 

任何幫助,這將有助於我顯示此對JSF的dataTable將會非常看重。

在此先感謝。

回答