首页 > 教学科研 > 教学科研
freemarker实现多层嵌套循环
发布时间:2024-01-15   点击量:63
字号:

FreeMarker是一个用Java语言编写的模板引擎,它基于模板来生成文本输出。它不仅可以用作表现层的实现技术,而且还可以用于生成XML,JSP或Java等。FreeMarker允许Javaservlet保持图形设计同应用程序逻辑的分离,这是通过在模板中密封HTML完成的。


java代码:


public class CategoryVO {

private Integer id;

private Integer pId;

private String name;

private String url;

private List<CategoryVO> children=new ArrayList<CategoryVO>();

// get set 省略

}


<#list arrayList as item>

    ${item.name}

    <#list item.getChildren() as item>

    ${item.name}

    <#list item.getChildren() as item>

    ${item.name}

    <#list item.getChildren() as item>

    ${item.name}

    <#list item.getChildren() as item>

    ${item.name}

    </#list>

    </#list>

    </#list>

    </#list>

</#list>


钉钉高效办公
中国知网
视频在线
档案工作
图书资源中心
返回顶部