Hi,
I am looking for some solutions on how to use the Sling models for CQ Pages.
For example, how the Sling model would look like, if I want to adapt the following page:
/content/geometrixx-media/en/entertainment/summer-blockbuster-hits-and-misses
Views
Replies
Total Likes
Check Below Link ,It tells about sling model creation
https://helpx.adobe.com/experience-manager/using/sling_models.html#
Views
Replies
Total Likes
Thanks Kishore.
The questions is specifically when the resource = cq:Page.
How will the Sling model look like ?
Views
Replies
Total Likes
We talked about this in that thread.
You would not do sling model on a cq:page node - ie:
/content/geometrixx-outdoors
A cq:page does not have props to let you model it.
You would use sling model on a cq:PageContent - ie:
/content/geometrixx-outdoors/jcr:content
Views
Replies
Total Likes
FRom the SLing Model Docs: https://sling.apache.org/documentation/bundles/models.html
In the simplest case, the class is annotated with @Model
and the adaptable class. Fields which need to be injected are annotated with@Inject
:
@Model(adaptables=Resource.class)public class MyModel {@Injectprivate String propertyName;}
In this case, a property named "propertyName" will be looked up from the Resource (after first adapting it to a ValueMap
) and it is injected.
A cq:page does not have props like jcr:title or jcr:description.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies