[FreeMarker-user] Calling #Macro Recursively
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
From: rizzz86 <ri...@ho...> - 2009-10-15 03:59:16
|
Hi, I am trying to call <#macro> recursively. I am getting the StackOVerFlowError, which means that their are unlimited number of calls made wiithin a macro. What I was actually doing is "Rendering a Menu". I have a List that contains a menu bean. That menu bean can also have its children and these children are also a list containing a menu bean. example: class MenuBean { String title; String url; List<MenuBean> children; etc.. } I can have N numbers of children for each menu (no limit). <#macro menugenerator menuList> <#if menuList??> <#foreach element in menuList> ${element.url} ${element.title} ..... // Generates Menu <#if element.children??> <@menugenerator menuList=element.children/> </#if> </#foreach> </#if> </#macro> Any reasons for the Error :-? -- View this message in context: http://www.nabble.com/Calling--Macro-Recursively-tp25902765p25902765.html Sent from the freemarker-user mailing list archive at Nabble.com. |