Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

What exactly is a sling model in AEM and what are the various use cases of Sling Models? To be precise about the question how can I make use of Sling models while creating a website using AEM?

Avatar

Level 4

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? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
4 Replies

Avatar

Correct answer by
Community Advisor

Avatar

Level 4

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..

Avatar

Community Advisor

@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.

Avatar

Level 2

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.