我的模特课是:
public class AreawiseSales{
private String location;
private List<Integer> areaCode;
private List<String> areaDescription;
//getter setters are there
}
我已在此类对象中添加了值,因此我想打印如下值:
LOC AREA Description
1 2 3
21 31
22 32
我的控制器是:
List<AreawiseSales> listOLists = new ArrayList<AreawiseSales>();
String locationCode="01";
List<Integer> areaCode = new ArrayList<Integer>();
areaCode.add(02);
areaCode.add(04);
areaCode.add(07);
List<String> areaDescription = new ArrayList<String>();
areaDescription.add("Tejgaon/Mohakhali");
areaDescription.add("Mirpur");
areaDescription.add("Shyampur");
如何打印这些值?
答案 0 :(得分:0)
Book selectedBook = (Book) htmlDataTable.getRowData();
参考读物:
它将打印如下内容:
int len = Math.max(listOLists.size(), Math.max(areaCode.size(), areaDescription.size()));
for(int i = 0; i < len; i++) {
System.out.printf("%10s", (i < listOLists.size()) ? listOLists.get(i) : "");
System.out.printf(" %10s", (i < areaCode.size()) ? areaCode.get(i) : "");
System.out.printf(" %30s", (i < areaDescription.size()) ? areaDescription.get(i) : "");
System.out.println();
}