Expand my Community achievements bar.

SOLVED

Sightly in AEM 6.3: org.apache.sling.api.request.RecursionTooDeepException:

Avatar

Level 6

In AEM 6.3 /apps/core, there is a list component. Try to reuse this component and just overwrite the item.html to make a news listing component.

I have a news component with title, date, content and News.java (using sling models: adaptables = SlingHttpServletRequest.class). 

A list component lists all news.

I reuse the list.html, however I have to modify the item.html to retrieve the news node. Don't know how exact to do that.

<sly  data-sly-resource="${resource @ appendPath='/jcr:content/root/news'}">

<div class="myproject-news"

     data-sly-use.article="myproject.news">

</sly>

        <h4 class="myproject-news-title">${ news.title }</h4>

But I am getting an error: org.apache.sling.api.request.RecursionTooDeepException:

Can anyone please help?

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

When you do

<sly  data-sly-resource="${resource @ appendPath='/jcr:content/root/news'}">

looks for all the resources/nodes under your current resource... Depending on where your resource to be rendered is located, you should be using :

<sly  data-sly-resource="${resource.path @ appendPath='/jcr:content/root/news'}">

or

<sly  data-sly-resource="${currentPage.path @ appendPath='/jcr:content/root/news'}">

View solution in original post

4 Replies

Avatar

Employee

Can you try the following?

Change this:

<sly  data-sly-resource="${resource @ appendPath='/jcr:content/root/news'}">

to

<sly  data-sly-resource="${'root/news' @ resourceType='your resource type'">

Avatar

Level 5

Hi ,

I am not able to replicate this exception in your code because this exception is thrown by the Sling implementation if to many recursive content inclusions take place.

Why are you using the list component to make the News Component.you want to display the title,date and content of the news for that either use multifield in dialog and then iterate through the data and display it. Other wise make a simple dialog having three field Title of news(ton), Date of news(datefield), Content(RTE) .At every new news drag and drop the component and fill the data into the dialog and display it for displaying below is the modiified code.

<div class="myproject-news">

        <h4 class="myproject-news-title">${properties.title}</h4>

          <h3> ${properties.date}</h3>

          {properties.content @ context='html'}

</div>

where date = name of date field in dialog (./date)

title =name of title in dialog (./title)

content = name of content (./content)

Thanks

Avatar

Correct answer by
Community Advisor

When you do

<sly  data-sly-resource="${resource @ appendPath='/jcr:content/root/news'}">

looks for all the resources/nodes under your current resource... Depending on where your resource to be rendered is located, you should be using :

<sly  data-sly-resource="${resource.path @ appendPath='/jcr:content/root/news'}">

or

<sly  data-sly-resource="${currentPage.path @ appendPath='/jcr:content/root/news'}">