If I have created a site structure in AEM, further in any of my page how can I make use of sling models.
For ex: I want to create a corporate website which makes use of various AEM components. Considering I have various pages named Home, About us, Contact what are the possible use cases of sling models in such scenario. Can some logic be implemented and accessed using the sling models in this case?
Solved! Go to Solution.
Views
Replies
Total Likes
@Manasi29 Please refer to the below URLs for a better understanding of the use case of the Sling Model:
https://www.bounteous.com/insights/2020/07/22/aem-sling-models-why-bother/
https://aem.redquark.org/2018/10/day-10-getting-to-know-sling-models.html
http://www.aemcq5tutorials.com/tutorials/adobe-aem-cq5-tutorials/sling-model-sightly-aem/
https://blogs.perficient.com/2021/04/02/writing-less-java-code-in-aem-with-sling-models/
@Manasi29 Please refer to the below URLs for a better understanding of the use case of the Sling Model:
https://www.bounteous.com/insights/2020/07/22/aem-sling-models-why-bother/
https://aem.redquark.org/2018/10/day-10-getting-to-know-sling-models.html
http://www.aemcq5tutorials.com/tutorials/adobe-aem-cq5-tutorials/sling-model-sightly-aem/
https://blogs.perficient.com/2021/04/02/writing-less-java-code-in-aem-with-sling-models/
Surely will refer the links given above.. It would be great if you could provide some insights on my next question that how can I make use of sling models in a actual website..
@Manasi29 As regards your second question, it depends on what kind of Components you are building for different Pages (Sling models are recommended for Components, where you are writing backend logic and you want it to achieve it with writing less Code (organized, modularized, short, and concise)). Coding components with sling models is the recommended AEM best practice from Adobe, as demonstrated by the implementation patterns in WCM Core Components. Please go through the above URLs I highlighted to get a better understanding.
The class is annotated with @Model and the adaptable class. Fields which need to be injected are annotated with @inject
https://sling.apache.org/documentation/bundles/models.html
This link helps you with out doubt.
Views
Likes
Replies
Views
Like
Replies