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>

这样就可以实现多重循环了,如果不知道有几层就多写几个list。