freeMark中遍历list集合

 
 1、controller中
 @RequestMapping(value="index",method=RequestMethod.GET)
    public ModelAndView userIndex(ModelMap map) {
        List list = new DBoperator().findAllTable();
        List tables = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            Tables table = new Tables();
            table.setTableName(list.get(i).toString());
            tables.add(table);
        }
        map.put("tables", tables);//传到前台的Tables类型的list集合
        return new ModelAndView("user/index");
    }
 2、ftl中
    

导出报表为PDF文档

<#list tables as tb>
tableName
${tb.tableName?default('未设置')}

你可能感兴趣的:(freeMark学习)