Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

my child tittle is not coming in list in sightly


Level 2


I written the below sightly and below java code

my requirement is that my level 1 child tittle should come as list but it coming as paragraph, as shown below.



***********JAVA CODE**********

import java.util.ArrayList;
import java.util.Iterator;

import javax.annotation.PostConstruct;
import javax.inject.Inject;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Via;
import org.apache.sling.models.annotations.injectorspecific.Self;
import org.apache.sling.models.annotations.injectorspecific.SlingObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.day.cq.wcm.api.Page;
import com.day.cq.wcm.api.PageFilter;
import com.day.cq.wcm.api.PageManager;
import com.te.aem.sling.model.IndustryModel;

@Model(adaptables = SlingHttpServletRequest.class,
adapters = IndustryModel.class,
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class IndustryModelImpl implements IndustryModel {

private static final Logger logger = LoggerFactory.getLogger(IndustryModelImpl.class);

Page childPage;

//String childTitle;

private String linkLabel;

private String linkPath;

private String childTitle;

ResourceResolver resourceResolver;

@Deleted Account
SlingHttpServletRequest request;

public String getLinkLabel() {
return linkLabel;

public String getLinkPath() {
// TODO Auto-generated method stub
return linkPath;

public ArrayList<String> getChildTitle() {

//String children = linkPath;
ResourceResolver resourceResolver = request.getResourceResolver();
PageManager pageManager = resourceResolver.adaptTo(PageManager.class);
//ArrayList pageList = new ArrayList();
Page rootPage = pageManager.getPage(linkPath);
logger.info("rootPage === ++++++++++++ " + rootPage);
//Page rootPage = linkPath;
Iterator<Page> rootPageIterator = rootPage.listChildren(new PageFilter(false, false), false);
ArrayList<String> childTitles = new ArrayList<String>() ;

childPage = rootPageIterator.next();
childTitle = childPage.getTitle();
childTitles.add(childTitle) ;
logger.info("childTitle inside init === "+childTitle);


return childTitles ;

protected void init() {






***************SIGHTLY CODE******

<sly data-sly-use.industryModel="com.aem.sling.model.IndustryModel">

<h2>Haritha test :${industryModel.linkPath}</h2>





<div data-sly-list="${industryModel.childTitle}">



3 Replies


Employee Advisor


<sly data-sly-use.industryModel="com.aem.sling.model.IndustryModel">
    <h2>Haritha test :${industryModel.linkPath}</h2>
    <ul data-sly-list="${industryModel.childTitle}">

Your syntax is worng, try above




Level 3

Hi @haritha6 ,

Please try updating the htl code as below

<div data-sly-list.title="${industryModel.childTitle}">









Community Advisor

Use below way to print title of all child pages:



<sly data-sly-use.industryModel="com.aem.sling.model.IndustryModel">
    <ul data-sly-list="${industryModel.childTitle}">
        <li>${item}</li>    //gives title of all child pages as it is the current item in the iteration.