Re: Calling #Macro Recursively
Firoza Saiyed <[email protected]> Thu, 23 Oct 2014 12:00:09 -0700
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <-7712909954632997207@unknownmsgid> |
Hi Daniel, Yes there was some null check needed which i did and i could now see the results being displayed but now the problem is it just displays the first level hierarchy. It doesn't continue till n level though we have data so still the problem is not resolved. Sent from my Windows Phone From: Daniel Dekany Sent: 23-10-2014 11:35 PM To: firoza Cc: [email protected] Subject: Re: [FreeMarker-user] Calling #Macro Recursively I don't believe that solving this problem involves any advanced FreeMarker features. It's just generic algorithm writing. Thus, if you have a *minimal* example that demonstrates an aspect of FreeMarker that you don't get, please post that. Also, when your problem involves an error, always include the error message. Thursday, October 23, 2014, 7:43:00 PM, firoza wrote: > Hi Deniel, > I tried for recursive call but its not working it's giving errors at > runtime. > > Below is what i want to achieve: > I have a Java Bean (pojo) with followin fields with getter and setter > methods. > > The pojos are populated with data using the recursive function of java. > > I have productSearchResultList bject which is the list of type > HierarchyProductSearchResult(which is populated as metioned above). > Now I want to display this list in ftl > > The format is : > //Iterate the productSearchResultList and if the recods has children then > open the new ul and display all its children in li.. This will go till n > level > <ul> > <li> > > > //this entry has children > <ul> > <li> > <ul> > <li></li> > </ul> > </li> > <li></li> > <li></li> > </ul> > </li> > > <li></li> > ... > </ul> > > In each <li> I need to dispaly the infomation in a table something like this > > > > ${productresult.chpd} > > ${productresult.conf} > > ${productresult.conf} > > > > The code in FTL: > > <div class="col-results"> > > <#macro hierarchy searchResultList> > <ul> > <#list > searchResultList as productresult> > > <#assign detailViewPopUp="Y"> > > <li> > > > > <#if productresult.hierarchy.children?has_content> > > <@liferay_ui.message key="resultview.hierarchy.click"/> > <JavaScript:void(0);> > > </#if> > > > > > > ${productresult.chpd} > > ${productresult.conf} > ........ > > > > > > > <#if productresult.hierarchy.children?has_content> > > > > <@hierarchy searchResultList=productresult.hierarchy.children/> > > > > </#if> > > </li> > > </#list> > </ul> > </#macro> > > <@hierarchy searchResultList=productSearchResultList/> > > </div> > > > Please let me know where I am making the mistake. I got stuck in this. > > Thanks, > Firoza > > > > -- > View this message in context: > http://freemarker.624813.n4.nabble.com/Calling-Macro-Recursively-tp626735p4655304.html > Sent from the freemarker-user mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > _______________________________________________ > FreeMarker-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/freemarker-user > -- Thanks, Daniel Dekany ------------------------------------------------------------------------------ _______________________________________________ FreeMarker-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freemarker-user