html中需生成一个表格,但表格行数不确定
html
<#list LIST as lender> ${lender.name!""} ${lender.idType!""} ${lender.idNum!""} ${lender.L1!""} ${lender.L2!""} ${lender.L3!""} ${lender.L4!""} ${lender.L5!""} ${lender.L6!""} ${lender.L7!""} ${lender.L8!""} ${lender.L9!""} java代码
List<LenderInfo> list = vo.getLenderList();
List<Map<String, Object>> paramList = new ArrayList<>(); if(list != null && vo.getLenderList().size() > 0) { for(int i = 1; i <= vo.getLenderList().size(); i++){ Map<String, Object> paramMap = new HashMap<>(); paramMap.put("name", list.get(i - 1).getName()); paramMap.put("idType", list.get(i - 1).getIdType()); paramMap.put("idNum", list.get(i - 1).getIdNum()); BigDecimal lenderAmount = list.get(i - 1).getLenderAmount(); String[] lenderAmountArr = moneyToArr(lenderAmount); m = 0; for (int j = 1; j < 10; j++) { if (lenderAmountArr.length + j == 9) { paramMap.put("L" + j, "¥"); m = j; } else if (lenderAmountArr.length + j < 9) { paramMap.put("L" + j, ""); } else { paramMap.put("L" + j, lenderAmountArr[j - m - 1]); } } paramList.add(paramMap); } } parameters.put("LIST", paramList);String t = tm.mergeFile(templateFileName, parameters);