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

Sling Model | AEM Community Blog Seeding




Sling Model by Techinnovia



After reading this article, you should have an

Understand of Sling Models
Benefits of Sling Models
Understand how to use Sling Models in an HTL template
Development Goals

Sling Models are available since AEM 6.0 but can also be installed in CQ 5.6.1.
Main advantages of using Sling Models are

You can write your code based on design patterns. If you use Sling Models you can remove all business logic from JSP and do not scriplets.

It’s easier to test Sling Models, because they are Java classes and can be covered with unit test. Also, it’s easier to add logging.

Costs for introducing of new developers are lower And development is faster.
What is Sling Models? – Old Approach

public class OldModel {
private String title;
private String decription;
public String getTitle(){ ... }
public void setTitle(String title){ ... }
public String getDescription(){ ... }
public void setDescription(String description){ ... }

Let’s get familiar with the life before Sling Models. Let’s look at this eg. Let’s say you need to Adapt a resource to the class which has number of properties, such as title & description for that we need to create a Java bean with private fields, getters & setters.

Read Full Blog

Sling Model


Please use this thread to ask the related questions.

Kautuk Sahni

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies