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? | Community
Skip to main content
Level 3
April 12, 2022
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?

  • April 12, 2022
  • 2 replies
  • 4319 views

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? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Manasi29Author
Level 3
April 12, 2022

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

Bhuwan_B
Community Advisor
Community Advisor
April 12, 2022

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

PhaniRajuTanneru
Level 2
April 12, 2022

The class is annotated with @Model and the adaptable class. Fields which need to be injected are annotated with @586265

https://sling.apache.org/documentation/bundles/models.html

This link helps you with out doubt. 😊