내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

looping in HTL sly in AEM

Avatar

Level 2

Hi,

 

I need to loop according to given Integer input.

 

Eg - According to user input, i need to repeat to print some HTML elements.

 

if user input is 1,

<div> 1 <div>

 

if user input is 2

<div> 1 <div>

<div> 2 <div>

 

How can i achieve this from HTL.

 

Thanks

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Community Advisor

HTL does not support traditional looping, arithmetic operations. 

you have to create a list from user input inside the sling Model as suggested by 

and then you can use data-sly-repeat
 
Arun Patidar

AEM LinksLinkedIn

원본 게시물의 솔루션 보기

3 답변 개

Avatar

Level 6

Create an Integer List in the Sling Model based on the user input value. Fetch the list in HTL and loop over it.

Avatar

Level 2

You can use sly-list or sly-repeat base on requirement.

Avatar

정확한 답변 작성자:
Community Advisor

HTL does not support traditional looping, arithmetic operations. 

you have to create a list from user input inside the sling Model as suggested by 

and then you can use data-sly-repeat
 
Arun Patidar

AEM LinksLinkedIn